Stop overriding page title and #site-title with siteName (AI)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
biosiasandClaude Opus 5.5 committed 2026-10-27 00:05:44 +01:00
1 parent 96cefba24d
commit bef6538cb6
6 files changed
+14 -23

No files matched your search

-7
View File
@@ -78,13 +78,6 @@ function init() {
if (!document.getElementById('list-view') || !document.getElementById('article-view')) {
throw new Error('Missing required #list-view and/or #article-view element — see the "Embedding in an existing page" section of the README.');
}
// Optional embedding-page markup (see "Embedding in an existing
// page" in the README) — set once here rather than in
// showListView()/loadArticle() so a page that loads straight into
// an article route (a direct link) still gets it, not just one that
// starts on the list view.
const siteTitle = document.getElementById('site-title');
if (siteTitle) siteTitle.textContent = t('siteName');
});
// Show a top-level error if dependencies fail to load (or a mount point
+9 -2
View File
@@ -18,6 +18,12 @@ let currentGeneration = 0;
// everything.
let lastListHash = '#';
// The embedding page's own <title>, captured once when this module first
// runs (module scripts are deferred, so <title> is already parsed). cmkiss
// never names the page itself — list views restore this exactly, and the
// article view only prefixes it with the article's title.
const pageTitle = document.title;
function formatDate(value) {
if (!value) return '';
const date = new Date(`${String(value).slice(0, 10)}T12:00:00`);
@@ -27,7 +33,7 @@ function formatDate(value) {
export function showListView() {
document.getElementById('list-view').hidden = false;
document.getElementById('article-view').hidden = true;
document.title = t('siteName');
document.title = pageTitle;
}
export function showArticleView() {
@@ -552,7 +558,8 @@ export async function loadArticle(hash) {
// cards, the description field here stays frontmatter-only (no
// auto-excerpt) — the full content is right below it either way.
const { readingTime, coverUrl } = deriveContentFields(meta, content, article.path);
document.title = `${meta.title || article.slug} | ${t('siteName')}`;
// Skip the separator when the embedding page has no <title> of its own.
document.title = `${meta.title || article.slug}${pageTitle ? ` | ${pageTitle}` : ''}`;
const element = document.importNode(templates.article, true);
const field = name => element.querySelector(`[data-field="${name}"]`);
field('title').textContent = meta.title || article.slug;