Skip to content

M7: Templates port + HTML5 semantic markup#17

Merged
simonbc merged 7 commits into
mainfrom
m7-templates
May 16, 2026
Merged

M7: Templates port + HTML5 semantic markup#17
simonbc merged 7 commits into
mainfrom
m7-templates

Conversation

@simonbc
Copy link
Copy Markdown
Owner

@simonbc simonbc commented May 15, 2026

Summary

Port the 2007 Jinja 1 templates to Jinja2 over modern HTML5 semantic markup, with a shared base layout and partials so the placeholder templates from M3-M6 stop duplicating doctype + chrome.

Approach

  • base.html carries doctype, <head>, header / main / aside / footer.
  • partials/site_header.html, partials/site_sidebar.html, partials/design_style.html, partials/form_error.html hold the shared chrome.
  • jottit/chrome.py is a Flask context_processor that exposes site, pages, design, is_signed_in, is_unclaimed, site_root_path, page_slug to every template.
  • Per-site design comes through as CSS custom properties so the M9 stylesheet rewrite can pick them up without coordinating with this template.

Test plan

  • Step 1: base.html + partials + context processor + port notfound.html / deleted.html
  • Step 2: Front page (index.html)
  • Step 3: View / edit page templates
  • Step 4: Site auth templates (claim, signin, forgot/change password)
  • Step 5: Admin templates (settings, design, change-site-address, change-password, delete)
  • Step 6: History / diff / changes templates

🤖 Generated with Claude Code

simonbc and others added 7 commits May 15, 2026 17:54
Foundation for the M7 templates port:

- base.html with HTML5 semantic skeleton (header / main / aside /
  footer). Includes a NOINDEX meta for private/secret-URL sites,
  matches the 2007 behavior.
- partials/site_header.html — site title, subtitle, primary nav
  (recent changes / settings / design / signin·signout). Shows a
  "Claim this site" banner above the header when the site is
  unclaimed.
- partials/site_sidebar.html — page list + new-page form.
- partials/design_style.html — exposes the design row as CSS custom
  properties (--header-color, --title-font, etc) so the M9
  stylesheet rewrite can reference them without coordinating with
  this template.
- partials/form_error.html — inline form error block.
- jottit/chrome.py — Flask context_processor that surfaces site,
  pages, design, is_signed_in, is_unclaimed, and a few helpers to
  every template.
- list_pages() DB helper for the sidebar.

Two simple existing templates (notfound, deleted) are ported to
{% extends "base.html" %} as a smoke test. The bigger
view/edit/admin/history templates land in subsequent commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the M2 placeholder textarea-only form with a real front page:
hero with the Jottit tagline, a content textarea, and an optional
custom-subdomain field that funnels into `public_url` on the index
POST handler.

The form is autofocused on the textarea and lives in a single
<article> so the apex page reads cleanly even without the per-site
chrome (header / sidebar are hidden when g.site is None).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
view_page now extends base.html, uses semantic <article> / <header> /
<footer> / <time>, and exposes RSS / JSON Feed `<link rel="alternate">`
in the head. Browsing an old revision (?r=N) gets a banner with
prev/next/latest navigation and a "Revert page to this revision" form
for editors.

edit_page extends base.html with a single edit form; Save and Cancel
sit alongside a Delete button on named pages (Delete is hidden for
the home page since it can't be deleted).

new_site() now seeds the design row with `system-ui, sans-serif`
instead of `Lucida_Grande` — the default reaches the visitor's OS
font without shipping a webfont, and the value still works as a
literal font-family in the design CSS custom property.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
claim_site, signin, forgot_password, and change_password now all
extend base.html and use the shared form_error partial. Each one is
a single <article> with semantic <header>, <form>, <fieldset> /
<legend> for grouped radio inputs, and <button> elements (no more
<input type="submit">).

Also fixes a relative-URL bug in the placeholder signin template:
its "Forgot your password?" link pointed at "site/forgot-password",
which from /site/signin resolves to /site/site/forgot-password. The
new template uses a bare "forgot-password" sibling href.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
All five admin templates now extend base.html and share the form
chrome via the form_error partial:

- admin_settings: title / subtitle / email / security plus a nav
  list of the other admin pages (change-site-address, change-
  password, design, export, delete).
- admin_change_site_address: single input with pattern hint.
- admin_change_password: current + new password.
- admin_design: <fieldset>-grouped 13-field design form.
- admin_delete: confirmation form with a destructive-styled button.

<button type="submit"> throughout (no more <input type="submit">);
destructive actions get a .destructive class hook so M9 can style
them red.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extend base.html and use semantic markup (article, header, ol, time).
History and changes templates link RSS/JSON feed alternates from
<head>. Diff body wrapped in a <section class="diff-body">.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ties)

Five-file split so the M8 CSS rewrite has clean seams:
- tokens.css: design custom properties + spacing scale
- reset.css: small custom reset
- base.css: element-level styling (h1-h6, a, button, inputs, code, …)
- components.css: layout + named regions (.page grid, .site-header,
  .revisions, .revision-banner, .form, …)
- utilities.css: one-off helpers (.visually-hidden, .muted-ish)

Linked from base.html with five separate <link> tags so HTTP/2 can
serve them in parallel and each file rewrites independently.
@simonbc simonbc merged commit c936026 into main May 16, 2026
1 check passed
@simonbc simonbc deleted the m7-templates branch May 16, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant