feat: scaffold plain .html pages that need no server config

This commit is contained in:
randogoth 2026-10-11 21:16:45 +03:00
parent 5e2e709496
commit 2ea4f461d3
2 changed files with 31 additions and 22 deletions

View file

@ -41,13 +41,16 @@ DEFAULT_LANG = "en"
THEME = "theme"
# The plugin reads the allowed elements and attributes from the Mews DTD and
# brings every page inside that subset. It only touches files ending .xhtml,
# so everything has to be written out under that suffix.
# brings every page inside that subset.
PLUGINS = ["pelican.plugins.mews"]
ARTICLE_URL = ARTICLE_SAVE_AS = "{{slug}}.xhtml"
PAGE_URL = PAGE_SAVE_AS = "{{slug}}.xhtml"
INDEX_SAVE_AS = "index.xhtml"
# This whole site is Mews, so its pages are plain .html: a server sends those
# as text/html, which section 7.1 asks for so a small markup error still shows
# as a page, and index.html is the directory index everywhere. The plugin
# defaults to .xhtml instead, for sites that are only partly Mews.
MEWS_SUFFIX = ".html"
ARTICLE_URL = ARTICLE_SAVE_AS = "{{slug}}.html"
PAGE_URL = PAGE_SAVE_AS = "{{slug}}.html"
# Markdown has to produce XML for the plugin to parse. Tables and definition
# lists are both in the Mews subset but need their extensions turned on.
@ -59,7 +62,11 @@ MARKDOWN = {{
}},
}}
# Mews pages carry no author styling, so there is nothing for these to show.
# Every page written under MEWS_SUFFIX goes through the plugin, and Pelican
# falls back to its own HTML templates for these when the theme has none. They
# have nothing to show on a site like this, so they stay off; give them
# templates in theme/templates/ if you want them.
DIRECT_TEMPLATES = ["index"]
AUTHOR_SAVE_AS = CATEGORY_SAVE_AS = TAG_SAVE_AS = ""
AUTHORS_SAVE_AS = CATEGORIES_SAVE_AS = TAGS_SAVE_AS = ARCHIVES_SAVE_AS = ""
# Pelican writes several feeds by default and they are all broken until
@ -115,7 +122,7 @@ ARTICLE = """\
{% block content %}
<h1>{{ article.title }}</h1>
{{ article.content }}
<p><a href="index.xhtml">All posts</a></p>
<p><a href="index.html">All posts</a></p>
{% endblock %}
"""
@ -125,7 +132,7 @@ PAGE = """\
{% block content %}
<h1>{{ page.title }}</h1>
{{ page.content }}
<p><a href="index.xhtml">All posts</a></p>
<p><a href="index.html">All posts</a></p>
{% endblock %}
"""
@ -157,7 +164,8 @@ A Mews site. The pages follow [Mews Profile 0.1](https://mews.page/spec/0.1).
uv run pelican content
```
The finished pages land in `output/`. To work on it with a reload on save:
The finished pages land in `output/`, as plain `.html` that any web server
serves correctly with no configuration. To work on it with a reload on save:
```shell
uv run pelican --autoreload --listen content
@ -165,12 +173,7 @@ uv run pelican --autoreload --listen content
## Publish it
Copy `output/` to any web server. Two things are worth setting:
- Serve `.xhtml` files as `text/html`. Section 7.1 of the spec asks for that,
so a browser still shows a page carrying a small markup error.
- Make `index.xhtml` the directory index, since the plugin only processes
files under that suffix. In Caddy: `file_server {{ index index.xhtml }}`.
Copy `output/` to any web server. Nothing to configure.
## Subscribe to it