refactor: merge neck.html into head.html#12114
refactor: merge neck.html into head.html#12114lokesh wants to merge 4 commits intointernetarchive:masterfrom
Conversation
The head/neck split was designed to let page templates inject metadata between two halves of <head>, but no template used this pattern. Combining them simplifies the template structure and makes it easier to render pages from FastAPI without relying on Infogami's thread-local context flags (sent_head/sent_neck). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove xmlns attribute (XHTML holdover, unnecessary with HTML5 doctype) - Replace verbose http-equiv Content-Type with <meta charset="utf-8"> - Remove empty <meta name="title"> - Remove <meta name="keywords"> (ignored by search engines since ~2009) - Remove author, creator, copyright, distribution meta tags (non-standard, no SEO or browser value, copyright year was frozen at 2007-2015) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
for more information, see https://pre-commit.ci
- Drop unused `page` parameter from head.html (only `title` is needed) - Remove `sent_head` guard from site.html (nothing sets it anymore) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| <html lang="$(get_lang() or 'en')"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta name="format-detection" content="telephone=no"> |
There was a problem hiding this comment.
Line-by-line breakdown of deletions from head.html
<html xmlns="http://www.w3.org/1999/xhtml" ...> — removed xmlns attribute
The xmlns="http://www.w3.org/1999/xhtml" namespace declaration is an XHTML artifact. Modern HTML5 (<!DOCTYPE html>) doesn't need it — browsers already know the namespace. Pure dead weight.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Replaced by the modern HTML5 equivalent: <meta charset="utf-8">. The http-equiv form is the old XHTML/HTML4 way to declare character encoding. The short form does the same thing.
<meta name="title" content="" />
This tag had an empty content attribute — it was doing literally nothing. The <title> element is what search engines use; meta name="title" is non-standard and was blank anyway.
<meta name="keywords" content="free books, books to read, ...">
Google has publicly stated it ignores meta keywords entirely (since ~2009). No major search engine uses this for ranking. It's SEO theater from the early 2000s.
<meta name="author" content="OpenLibrary.org" />
Not used by search engines for ranking. Browsers don't display it. It's informational metadata that adds no practical value — the site identity is already conveyed by the domain, <title>, and structured data.
<meta name="creator" content="OpenLibrary.org" />
Same story as author — it's a non-standard meta tag with no browser or search engine behavior attached to it.
<meta name="copyright" content="Original content copyright; 2007-2015" />
Also non-standard, not used by search engines, and the date range was stale (stopped at 2015). Copyright info belongs in the page footer or a dedicated page, not a meta tag.
<meta name="distribution" content="Global" />
Another relic from early SEO. No search engine has ever documented using this tag. It has zero effect on how content is distributed or indexed.
Self-closing /> on void elements
The old tags used /> (e.g., <meta ... />). The new ones use >. This is the HTML5 convention — self-closing slashes on void elements are allowed but meaningless in HTML5. Another XHTML holdover cleaned up.
|
Would it be viable to completely stop using ctx in the template and instead pass in those three or four things it needs? I think it would be preferable as we aim to move towards more explicit templates inputs and outputs instead of calling globals. But I'm not sure if it's too much. Thanks again for doing this! It's a big help |
The ctx values are set across a large number of templates scattered around the codebase. Making them explicit params would require reworking how these values flow through in many spots. Directionally, it's a good idea, but a bigger refactor than this PR warrants |
Merge
neck.htmlintohead.htmland clean up the combined template. [refactor]The
head.html/neck.htmlsplit was designed to let page templates inject metadata between the two halves of<head>, but no template uses this pattern. Combining them simplifies the template structure and removes thesent_head/sent_neckcontext flags, making it easier to render pages from FastAPI without relying on Infogami's thread-local context.Technical
neck.htmlintohead.html— description meta, title, links, and metatags now live at the end ofhead.html;neck.htmlis deleted.sent_head/sent_neckcontext flags —site.htmlnow unconditionally rendershead.tmplwith just atitleparam (no guard, nopageparam).pageparameter fromhead.html— onlytitleis needed.xmlnsattribute (XHTML holdover), verbosehttp-equiv Content-Type(replaced with<meta charset="utf-8">), empty<meta name="title">,<meta name="keywords">(ignored by search engines since ~2009), andauthor/creator/copyright/distributiontags (non-standard, copyright year frozen at 2007–2015).messages.potreferences fromneck.html→head.html.Testing
docker compose upand visit http://localhost:8080<head>contains charset, description, title, CSS links, and closes with</head>before<body>neck.htmlrender call appears in the outputScreenshot
N/A — no visual changes expected.
Stakeholders
@RayBB cc: @cdrini