Skip to content

Replace page.is_homepage with a builder-portable homepage check in every overrides/main.html #71

Description

@lesnik512

Spun off from #60 (Zensical revisit check, 2026-09-06). Worth doing on its own schedule — it is
correct under MkDocs today and independent of whether we ever port.

What

In the four repos that ship an overrides/main.html, replace page.is_homepage with a homepage
check both builders expose:

{% if nav.homepage and page.url == nav.homepage.url %}
  • modern-python/.github — overrides/main.html, twice: htmltitle (L8) and extrahead (L25)
  • modern-python/faststream-outbox — overrides/main.html L6, extrahead, og/twitter title
  • modern-python/modern-di — same shape, L6
  • modern-python/lite-bootstrap — same shape, L6

The nav.homepage and guard matters: MkDocs types it Page | None.

Why

page.is_homepage is a MkDocs Page property with no Zensical equivalent. At Zensical 0.0.59,
grep -rn is_homepage over zensical/zensical returns nothing, and the render context built in
crates/zensical/src/structure/page.rs exposes only url, canonical_url, edit_url, path,
title, meta, content, toc, ancestors, previous_page, next_page.

It fails silently, not loudly — Zensical's own bundled theme (zensical/ui src/base.html L89,
tag v0.0.27) still references page.is_homepage, which resolves undefined → falsy. Under Zensical
today every one of these templates would emit a wrong og:title / twitter:title on its home page,
and .github would additionally emit a doubled <title> — the exact bug the 2026-07 spike papered
over.

nav.homepage is exposed by both builders:

  • MkDocs — homepage: Page | None, "The page object for the homepage of the site":
    https://www.mkdocs.org/dev-guide/themes/
  • Zensical 0.0.59 — NAVIGATION_FIELDS = ["items", "homepage", "hash"] in
    crates/zensical/src/structure/nav/view.rs L38, resolved at L161–163 by serializing
    navigation.homepage (a NavigationItem, which carries url)

Caveat, stated so it is not rediscovered: the MkDocs half is documented; the Zensical half is
read from source, not from docs — Zensical publishes no template-context reference at all. Re-verify
at port time.

Non-goals

Not a migration. #60 stays open and stays blocked on exclude_docs and validation.omitted_files;
this change does not depend on it and should not wait for it.

Verification

Per repo: build the docs, and confirm the home page's <title>, og:title and twitter:title are
byte-identical before and after, plus one non-home page unchanged. Every affected repo already runs
mkdocs build --strict in CI.

Four PRs, one per repo.

Activity

  1. lesnik512 commented on Sep 6, 2026

    @lesnik512
    MemberAuthor

    Status check on 2026-09-06, scanning overrides/main.html across all 28 org repos via the contents API rather than the four listed above. The scope in the body is off in both directions.

    Seven repos ship an overrides/main.html, not four. Missing from the list: semvertag, httpware, faststream-redis-timers. All three still use page.is_homepage.

    Two of the four listed are already done:

    • modern-python/.github — done
    • modern-python/modern-di — done, landed as 02e9cf7

    faststream-outbox is done but unpushed. The change is written and committed as 9571ce6 ("chore(docs): use a builder-portable homepage check in the override template") on a chore/portable-homepage-check branch that has not been pushed. It reads as stale from the API. Push or open the PR rather than redoing it.

    Actually remaining: four repos, and they are the same edit four times. lite-bootstrap, semvertag, httpware and faststream-redis-timers each have exactly one occurrence, at line 6, and the line is byte-identical in all four:

    {% set title = (page.title ~ ' · ' ~ config.site_name) if (page.title and not page.is_homepage) else config.site_name %}

    That is the htmltitle shape, the same one .github had at L8, not the extrahead og/twitter shape the body describes for faststream-outbox and lite-bootstrap. So lite-bootstrap is listed under the wrong shape above. Whoever picks this up should apply one substitution to four files, not derive four bespoke fixes.

    The nav.homepage and guard note in the body still applies, and the verification step (home page <title> byte-identical before and after, plus one non-home page) is unchanged.

    Nothing here touches the Zensical reasoning or the #60 relationship, both of which still read correctly.

  2. lesnik512 commented on Sep 6, 2026

    @lesnik512
    MemberAuthor

    Done in all four repos, each landing only overrides/main.html:

    page.is_homepage is gone from every override template, replaced by nav.homepage and page.url == nav.homepage.url. Each was verified by building the site with mkdocs build --strict before and after and diffing the output recursively: byte-identical in all four, so this is a no-op under MkDocs today.

    The underlying gap stays open as item 3 of #60's revisit trigger: Zensical still exposes no documented template context, and nav.homepage is read from its source rather than its docs.

  3. lesnik512 commented on Sep 15, 2026

    @lesnik512
    MemberAuthor

    This was generated by AI during triage.

    Follow-up — 2026-09-15

    The 2026-09-06 closing note ("page.is_homepage is gone from every override template") was true for the four repos in scope then, but three repos gained an overrides/main.html afterwards with the same htmltitle-shape line at L6. Found while re-running the #60 gate check.

    Same substitution as lite-bootstrap#170, one PR per repo, each verified by a mkdocs build --strict before/after diff (byte-identical output):

    After #76 lands, page.is_homepage is gone from all seven override templates in the org. that-depends has a mkdocs.yml but no override, so nothing to do there.

  4. lesnik512 commented on Sep 15, 2026

    @lesnik512
    MemberAuthor

    This was generated by AI during triage.

    modern-python/faststream-redis-timers#76 merged as 716e038 after the ty drift was fixed in faststream-redis-timers#77. page.is_homepage is now gone from all seven override templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions