Skip to content

refactor: merge neck.html into head.html#12114

Open
lokesh wants to merge 4 commits intointernetarchive:masterfrom
lokesh:head-and-neck
Open

refactor: merge neck.html into head.html#12114
lokesh wants to merge 4 commits intointernetarchive:masterfrom
lokesh:head-and-neck

Conversation

@lokesh
Copy link
Collaborator

@lokesh lokesh commented Mar 17, 2026

Merge neck.html into head.html and clean up the combined template. [refactor]

The head.html/neck.html split 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 the sent_head/sent_neck context flags, making it easier to render pages from FastAPI without relying on Infogami's thread-local context.

Technical

  • Merged neck.html into head.html — description meta, title, links, and metatags now live at the end of head.html; neck.html is deleted.
  • Removed sent_head/sent_neck context flagssite.html now unconditionally renders head.tmpl with just a title param (no guard, no page param).
  • Dropped unused page parameter from head.html — only title is needed.
  • Removed outdated meta tagsxmlns attribute (XHTML holdover), verbose http-equiv Content-Type (replaced with <meta charset="utf-8">), empty <meta name="title">, <meta name="keywords"> (ignored by search engines since ~2009), and author/creator/copyright/distribution tags (non-standard, copyright year frozen at 2007–2015).
  • Updated messages.pot references from neck.htmlhead.html.

Testing

  1. docker compose up and visit http://localhost:8080
  2. View page source — verify <head> contains charset, description, title, CSS links, and closes with </head> before <body>
  3. Check that no neck.html render call appears in the output
  4. Confirm pages still load correctly (home, book pages, search results)
  5. Verify meta description and title render properly on a book detail page

Screenshot

N/A — no visual changes expected.

Stakeholders

@RayBB cc: @cdrini

lokesh and others added 4 commits March 17, 2026 10:45
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>
- 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>
@lokesh lokesh changed the title merge neck.html into head.html refactor: merge neck.html into head.html Mar 17, 2026
@lokesh lokesh marked this pull request as ready for review March 17, 2026 18:25
@lokesh lokesh requested a review from RayBB March 17, 2026 18:25
<html lang="$(get_lang() or 'en')">
<head>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@RayBB
Copy link
Collaborator

RayBB commented Mar 17, 2026

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

@lokesh
Copy link
Collaborator Author

lokesh commented Mar 17, 2026

Would it be viable to completely stop using ctx in the template and instead pass in those three or four things it needs?

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

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead On Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants