diff --git a/example/content/2025-08-03-multi-site-support.md b/example/content/2025-08-03-multi-site-support.md new file mode 100644 index 0000000..a2185aa --- /dev/null +++ b/example/content/2025-08-03-multi-site-support.md @@ -0,0 +1,71 @@ +--- +title: Multi-Site Support in Marmite +slug: multi-site-support +tags: features, docs, content-organization +author: rochacbruno +--- + +# Multi-Site Support in Marmite + +Marmite now supports generating multiple independent sites from a single project! This feature allows you to create subsites with their own themes, configurations, and search indexes. + +## How it works + +Any directory inside your `content` folder that contains a `site.yaml` file will be processed as a subsite. Each subsite: + +- Has its own independent configuration +- Can use a different theme +- Maintains a separate search index +- Is served at its own URL path (e.g., `/site1/`) + +## Creating a subsite + +1. Create a directory in your content folder: + ```bash + mkdir content/site1 + ``` + +2. Add a `site.yaml` configuration file: + ```yaml + name: My Subsite + theme: theme_template + enable_search: true + ``` + +3. Add content files (markdown) to the subsite directory + +4. Build your site as usual - Marmite will automatically detect and process the subsite + +## Example structure + +``` +example/ +├── marmite.yaml # Main site config +├── content/ +│ ├── posts.md # Main site content +│ └── site1/ +│ ├── site.yaml # Subsite config +│ ├── about.md # Subsite content +│ └── posts.md # More subsite content +└── site/ # Generated output + ├── index.html # Main site + └── site1/ + └── index.html # Subsite at /site1/ +``` + +## Configuration inheritance + +Subsites inherit certain configuration values from the parent site if not specified: + +- Theme selection +- Date format settings +- Other default values + +## Use cases + +- Documentation sites with versioned content +- Multi-language sites +- Separate blogs or sections with different themes +- Project portfolios with independent sections + +This feature enables complex site architectures while maintaining Marmite's simplicity and performance. \ No newline at end of file diff --git a/example/content/site1/2025-01-01-post.md b/example/content/site1/2025-01-01-post.md new file mode 100644 index 0000000..cb6adb3 --- /dev/null +++ b/example/content/site1/2025-01-01-post.md @@ -0,0 +1,29 @@ +--- +title: Welcome to Site1 +tags: subsite, announcement +author: Site1 Admin +--- + +# Welcome to Site1 + +This is the first post on our independent subsite! This site has its own theme, configuration, and search index. + +## What makes this subsite special? + +- Independent theme configuration (using theme_template) +- Separate search index +- Own URL space at `/site1/` +- Isolated content management + +### Testing features + +This subsite demonstrates Marmite's multi-site capabilities. + + + + +### A photo from the main site + +Using `../` to go up one level to the main site. + + \ No newline at end of file diff --git a/example/content/site1/about.md b/example/content/site1/about.md new file mode 100644 index 0000000..d134b4f --- /dev/null +++ b/example/content/site1/about.md @@ -0,0 +1,3 @@ +# Hello from site1 + +This is a test of the site1 \ No newline at end of file diff --git a/example/content/site1/media/bruno.jpg b/example/content/site1/media/bruno.jpg new file mode 100644 index 0000000..252c320 Binary files /dev/null and b/example/content/site1/media/bruno.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/gallery.yaml b/example/content/site1/media/gallery/site1photos/gallery.yaml new file mode 100644 index 0000000..8058db4 --- /dev/null +++ b/example/content/site1/media/gallery/site1photos/gallery.yaml @@ -0,0 +1,3 @@ +name: "Site 1 Photos" +ord: asc +cover: "window.jpg" diff --git a/example/content/site1/media/gallery/site1photos/palms.jpg b/example/content/site1/media/gallery/site1photos/palms.jpg new file mode 100644 index 0000000..bb3146f Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/palms.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/passage.jpg b/example/content/site1/media/gallery/site1photos/passage.jpg new file mode 100644 index 0000000..9a3834f Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/passage.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/pool.jpg b/example/content/site1/media/gallery/site1photos/pool.jpg new file mode 100644 index 0000000..7677f33 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/pool.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/sunflower.jpg b/example/content/site1/media/gallery/site1photos/sunflower.jpg new file mode 100644 index 0000000..516e8d1 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/sunflower.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/sunset.jpg b/example/content/site1/media/gallery/site1photos/sunset.jpg new file mode 100644 index 0000000..5ecd7f0 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/sunset.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/surfers.jpg b/example/content/site1/media/gallery/site1photos/surfers.jpg new file mode 100644 index 0000000..c40eecf Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/surfers.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/thumbnails/palms.jpg b/example/content/site1/media/gallery/site1photos/thumbnails/palms.jpg new file mode 100644 index 0000000..d49d4d8 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/thumbnails/palms.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/thumbnails/passage.jpg b/example/content/site1/media/gallery/site1photos/thumbnails/passage.jpg new file mode 100644 index 0000000..cd4d746 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/thumbnails/passage.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/thumbnails/pool.jpg b/example/content/site1/media/gallery/site1photos/thumbnails/pool.jpg new file mode 100644 index 0000000..decd4ca Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/thumbnails/pool.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/thumbnails/sunflower.jpg b/example/content/site1/media/gallery/site1photos/thumbnails/sunflower.jpg new file mode 100644 index 0000000..37c1fd6 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/thumbnails/sunflower.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/thumbnails/sunset.jpg b/example/content/site1/media/gallery/site1photos/thumbnails/sunset.jpg new file mode 100644 index 0000000..c26ccd8 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/thumbnails/sunset.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/thumbnails/surfers.jpg b/example/content/site1/media/gallery/site1photos/thumbnails/surfers.jpg new file mode 100644 index 0000000..a64cca2 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/thumbnails/surfers.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/thumbnails/window.jpg b/example/content/site1/media/gallery/site1photos/thumbnails/window.jpg new file mode 100644 index 0000000..c527939 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/thumbnails/window.jpg differ diff --git a/example/content/site1/media/gallery/site1photos/window.jpg b/example/content/site1/media/gallery/site1photos/window.jpg new file mode 100644 index 0000000..ce7c4a8 Binary files /dev/null and b/example/content/site1/media/gallery/site1photos/window.jpg differ diff --git a/example/content/site1/shortcode-test.md b/example/content/site1/shortcode-test.md new file mode 100644 index 0000000..3412e8a --- /dev/null +++ b/example/content/site1/shortcode-test.md @@ -0,0 +1,74 @@ +--- +title: Shortcode Test for Subsite +date: 2025-01-02 +author: Site1 Admin +tags: [subsite, testing, shortcodes] +--- + +# Shortcode Test + +This is a test to verify that shortcodes work correctly in subsites and only show subsite-specific content. + +## Tags in this subsite + + + +## Tags in main site + + + +## Authors in this subsite + + + + +## Authors in main site + + + +## Recent posts in this subsite + + + +## Recent posts in main site + + + + +## Card in this subsite + + + +## Card for author in this subsite + + + +## Card for author from main site + + + + +## Card for tag in this subsite + + + + +## Card for tag from main site + + + + +## Gallery in this subsite + + + +## Gallery from main site + + + +## Table of Contents in this subsite + + + + +--- \ No newline at end of file diff --git a/example/content/site1/site.yaml b/example/content/site1/site.yaml new file mode 100644 index 0000000..11c24ab --- /dev/null +++ b/example/content/site1/site.yaml @@ -0,0 +1,4 @@ +name: A separate site +theme: theme_template +enable_search: true +fragments_fallback: main \ No newline at end of file diff --git a/example/shortcodes/authors.html b/example/shortcodes/authors.html index 3846b88..777f6c2 100644 --- a/example/shortcodes/authors.html +++ b/example/shortcodes/authors.html @@ -1,6 +1,6 @@ -{# Display a list of all authors with post counts. Params: ord=desc, items=0 #} -{% macro authors(ord="desc", items=0) %} -{% set author_map = group(kind="author", ord=ord, items=items) %} +{# Display a list of all authors with post counts. Params: ord=desc, items=0, site=current #} +{% macro authors(ord="desc", items=0, site="") %} +{% set author_map = group_from_site(kind="author", ord=ord, items=items, site=site) %}