Skip to content

feat: Subsites #329

Description

@rochacbruno

Marmite will allow the rendering of subsites, a subsite is made by subfolders on the content folder.

Right now the content_folder is basically

content/
   media/  (media files)
   *.md    (markdown files)

With subsites the structure will be

content/
   media/  (media files)
   *.md    (markdown files)
   site2/
       media/ (media files)
       *.md
       site.yaml
   site3/
       media/ (media files)
       *.md
       site.yaml

What identifies a subsite is the presence of site.yaml

How subsites are processed?

  1. First marmite will collect all the sites and add to site_data.subsites (each subsite is a complete separate structure with its own posts, pages, group mappings, galleries, generated_urls, each subsite is basically a separate instance of Data with some attributes taken from the main site.
  2. The site.yaml will contain individual site config that will configure the subsite, missing keys will assume default from the main config. (in other words, the main marmite.yaml config can be optionally overriden by the individual site.yaml)
  3. The site.yaml can be empty, on that case it assumes all the parent config.
  4. Marmite will collect content from all the sites before processing shortcodes, so shortcodes like card, tags, posts etc can refer to content on separate sites.
  5. The url_for function will take a new parameter site default to current site being processed
  6. The other tera functions will also take site and resolve to current site being processed (it may require dynamic registration of tera functions), this will allow the functionality of shorcodes like card, posts, pages, tags, series, streams. While also allowing the subsite to refer another site like passing `site="main" to refer to the main site.
  7. The result of rendering a subsite is written to output_dir/{subsite}/ which is the matching folder name
  8. The subsite can define a separate theme: on site.yaml
  9. The site.yaml does not allow the user to override locations such as template_folder, static_folder etc, all those are the same as the main site, but relative to the subsite output_dir/{site}
  10. The subsite is independent, so the output_dir/{site} has its own static/, media/ and all other generated files including feeds.
  11. The site.yaml, url: attribute is automatic resolved, to be the main url + /{subsite_folder}, unless the user specifies differently
  12. If subsite does not specify a theme then it uses the main site theme and templates.

Important

  • The main site (current functionality) is kept intact, acessing localhost:8000 will open the output_dir/index.html
  • The subsites are rendered as subfolders of the main site, so localhost:8000/site1/ will open output_dir/site1/index.html
  • The main site will render a /sites.yaml listing all subsites with links pointing to each one.
  • THe command marmite --new must be updated to take --site sitename argument (default None, main site)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions