Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mnemos frontend bundle

This directory is a frontend bundle for the Mnemos app. The app renders all public HTML pages from this bundle, so you can deploy Mnemos with your own templates and assets by pointing STATIC_DIR at a directory that follows the contract below. The templates are free-form; only the layout, the manifest, and the template variables are standardized.

Layout (required)

<bundle>/
  mnemos.toml        # manifest (required)
  templates/         # Jinja2 templates (required)
  public/            # static assets, served at /public (required)
    ...              # organize freely: css/, js/, img/, fonts/, pdf/, …

public/ is mounted at the URL prefix /public. Organize its interior however you like; reference assets as /public/<your-path> (e.g. /public/css/site.css).

Manifest: mnemos.toml

default_locale = "fr"          # served at "/"; must be a key in [locales]

[locales.fr]
label = "Français"             # shown in a language switcher
feed_title = "My blog"         # required: RSS channel title for this locale
feed_description = ""          # optional: RSS channel description

[locales.en]
label = "English"
feed_title = "My blog"

Each locale has its own RSS feed at /api/public/v1/rss?locale=<code>, using that locale's feed_title / feed_description. An unknown locale returns 404.

Routes & locales

The default locale is served at the root; other locales are served under a path prefix:

Route Template
/ , /{locale}/ posts/list.html (or posts/_items.html for htmx requests)
/posts/{slug} , /{locale}/posts/{slug} posts/detail.html
/archives , /{locale}/archives archives.html (locale-scoped)
/pages/{slug} , /{locale}/pages/{slug} pages/detail.html
unknown locale prefix 404 (404.html)

The default locale has a single canonical address: requesting it with an explicit prefix (e.g. /<default_locale>/posts/x) issues a 301 redirect to the unprefixed URL (/posts/x), query string preserved. Build internal links with url_prefix (below) and you never hit this redirect during normal navigation.

Template variables

Every template receives these standard variables:

  • locale — active locale code (e.g. "fr").
  • default_locale — the default locale code.
  • localesdict[code -> {label, feed_title, feed_description}], for building a language switcher.
  • url_prefix"" for the default locale, "/<locale>" otherwise. Prefix all internal links with it (e.g. {{ url_prefix }}/posts/{{ post.slug }}).

Page-specific variables:

  • list / _items: posts, next_cursor, tag.
  • post detail: post, content_html.
  • page detail: page, content_html.
  • archives: by_year (dict[year -> posts]), years, tags.

Filters / globals: datefmt(locale) (Babel locale-aware dates), markdown, current_year, max_messages_per_conversation, max_input_message_text_length.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages