Chameleon

Legal Documents

Create and manage legal documents

Legal Documents

Learn how to create and manage legal documents like Terms of Service, Privacy Policy, and Cookie Policy in Chameleon.

Overview

Legal documents in Chameleon are managed as MDX files in the content/legal/ directory. They support Markdown formatting, internationalization, and can be easily customized for different jurisdictions and requirements.

Document Types

Common Legal Documents

  • Terms of Service - User agreement and service terms
  • Privacy Policy - Data collection and usage policies
  • Cookie Policy - Cookie usage and tracking information
  • Refund Policy - Return and refund terms
  • Disclaimer - Legal disclaimers and limitations

Document Structure

content/legal/
├── terms-of-service.mdx
├── privacy-policy.mdx
├── cookie-policy.mdx
├── refund-policy.mdx
└── disclaimer.mdx

Content Management

Creating Legal Documents

---
title: Terms of Service
description: Terms and conditions for using Chameleon
---

# Terms of Service

Last updated: [Date]

## 1. Acceptance of Terms

By accessing and using Chameleon ("Service"), you accept and agree to be bound by the terms and provision of this agreement.

## 2. Use License

Permission is granted to temporarily download one copy of Chameleon per device for personal, non-commercial transitory viewing only.

## 3. Disclaimer

The materials on Chameleon are provided on an 'as is' basis. Chameleon makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties.

## 4. Limitations

In no event shall Chameleon or its suppliers be liable for any damages arising out of the use or inability to use the materials on Chameleon.

## 5. Accuracy of Materials

The materials appearing on Chameleon could include technical, typographical, or photographic errors.

## 6. Links

Chameleon has not reviewed all of the sites linked to our website and is not responsible for the contents of any such linked site.

## 7. Modifications

Chameleon may revise these terms of service at any time without notice.

## 8. Governing Law

These terms and conditions are governed by and construed in accordance with the laws of [Jurisdiction].

## Contact Information

If you have any questions about these Terms of Service, please contact us at [email].

Privacy Policy Template

---
title: Privacy Policy
description: How we collect, use, and protect your information
---

# Privacy Policy

Last updated: [Date]

## Information We Collect

### Personal Information
- Email address
- Name
- Profile information

### Usage Information
- IP address
- Browser type
- Pages visited
- Time spent on site

## How We Use Information

We use the information we collect to:
- Provide and maintain our service
- Process transactions
- Send notifications
- Improve our service

## Information Sharing

We do not sell, trade, or otherwise transfer your personal information to third parties without your consent.

## Data Security

We implement appropriate security measures to protect your personal information.

## Cookies

We use cookies to enhance your experience on our website.

## Your Rights

You have the right to:
- Access your personal information
- Correct inaccurate information
- Delete your information
- Opt out of communications

## Contact Us

If you have questions about this Privacy Policy, contact us at [email].

Template Customization

Adding Legal Documents to Navigation

// src/components/navigation/footer.tsx
import Link from "next/link";

export function Footer() {
  return (
    <footer className="bg-gray-800 text-white py-8">
      <div className="container mx-auto px-4">
        <div className="grid grid-cols-1 md:grid-cols-4 gap-8">
          <div>
            <h3 className="text-lg font-semibold mb-4">Legal</h3>
            <ul className="space-y-2">
              <li>
                <Link href="/legal/terms-of-service" className="hover:text-gray-300">
                  Terms of Service
                </Link>
              </li>
              <li>
                <Link href="/legal/privacy-policy" className="hover:text-gray-300">
                  Privacy Policy
                </Link>
              </li>
              <li>
                <Link href="/legal/cookie-policy" className="hover:text-gray-300">
                  Cookie Policy
                </Link>
              </li>
              <li>
                <Link href="/legal/refund-policy" className="hover:text-gray-300">
                  Refund Policy
                </Link>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </footer>
  );
}

Creating Legal Document Pages

// src/app/[locale]/(default)/legal/[slug]/page.tsx
import { Metadata } from "next";
import { notFound } from "next/navigation";
import { getLegalDocument } from "@/lib/legal";

interface PageProps {
  params: { slug: string };
}

export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
  const document = await getLegalDocument(params.slug);
  
  if (!document) {
    return {};
  }
  
  return {
    title: document.title,
    description: document.description,
  };
}

export default async function LegalDocumentPage({ params }: PageProps) {
  const document = await getLegalDocument(params.slug);
  
  if (!document) {
    notFound();
  }
  
  return (
    <div className="container mx-auto px-4 py-8">
      <article className="max-w-4xl mx-auto prose prose-lg">
        <h1>{document.title}</h1>
        <div className="text-sm text-gray-600 mb-8">
          Last updated: {document.lastUpdated}
        </div>
        <div dangerouslySetInnerHTML={{ __html: document.content }} />
      </article>
    </div>
  );
}

Legal Document Utility

// src/lib/legal.ts
import fs from "fs";
import path from "path";
import matter from "gray-matter";

const legalDir = path.join(process.cwd(), "content/legal");

export async function getLegalDocument(slug: string) {
  try {
    const filePath = path.join(legalDir, `${slug}.mdx`);
    const fileContent = fs.readFileSync(filePath, "utf8");
    const { data, content } = matter(fileContent);
    
    return {
      slug,
      title: data.title,
      description: data.description,
      lastUpdated: data.lastUpdated,
      content,
    };
  } catch (error) {
    return null;
  }
}

export async function getAllLegalDocuments() {
  const files = fs.readdirSync(legalDir);
  
  return files
    .filter(file => file.endsWith(".mdx"))
    .map(file => {
      const slug = file.replace(".mdx", "");
      return getLegalDocument(slug);
    });
}

File Locations

  • content/legal/ - Legal document MDX files
  • src/app/[locale]/(default)/legal/[slug]/page.tsx - Legal document pages
  • src/lib/legal.ts - Legal document utilities
  • src/components/navigation/footer.tsx - Footer with legal links

Common Tasks

Create a New Legal Document

  1. Create MDX file in content/legal/
  2. Add frontmatter with title and description
  3. Write content using Markdown
  4. Add link to navigation
  5. Test the page

Update Legal Document

  1. Edit the MDX file
  2. Update the "Last updated" date
  3. Review content for accuracy
  4. Test the updated page

Add Legal Links to Footer

// Add to footer component
<Link href="/legal/terms-of-service">Terms of Service</Link>
<Link href="/legal/privacy-policy">Privacy Policy</Link>

Customize for Different Jurisdictions

---
title: Terms of Service
description: Terms and conditions for using Chameleon
jurisdiction: "United States"
---

# Terms of Service

## Governing Law

These terms and conditions are governed by and construed in accordance with the laws of the State of [State], United States.

Troubleshooting

Legal document not showing

Problem: Legal page returns 404

Solution:

  1. Check file exists in content/legal/
  2. Verify file extension is .mdx
  3. Check frontmatter is properly formatted
  4. Verify page route is correct

Content not rendering

Problem: Markdown content not displaying

Solution:

  1. Check MDX syntax is correct
  2. Verify content is properly parsed
  3. Check for HTML rendering issues
  4. Test with simple content first

Navigation links not working

Problem: Legal links in footer not working

Solution:

  1. Check link paths are correct
  2. Verify pages exist
  3. Check for typos in URLs
  4. Test links manually

Next Steps