Files
memind/platform-seo-html.mjs
T
john acca846856
Memind CI / Test, build, and release guards (pull_request) Failing after 4m17s
feat(seo-geo): 全页面 SEO/GEO 回填、统一检查与 Plaza 注入
引入批量回填与审计工具链,强制 mindspace-geo 元数据,扩展 sitemap/llms 收录 /learn,并为 Plaza 壳页注入 canonical/OG/JSON-LD;本地 593 页已通过 check:mindspace-cover。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 09:36:01 +08:00

62 lines
1.7 KiB
JavaScript

import { injectRobotsNoindex, injectSeoTags } from './mindspace-seo-tags.mjs';
import { injectGeoTags } from './mindspace-geo-tags.mjs';
import { buildMindspaceGeoPayload, upsertDescriptionMeta, upsertMindspaceGeoMeta } from './mindspace-geo-backfill.mjs';
import { injectOgTags, PLATFORM_SITE_NAME } from './mindspace-og-tags.mjs';
export function renderMindspaceGeoMetaTag(payload) {
return `<meta name="mindspace-geo" content='${JSON.stringify(payload).replace(/'/g, '&#39;')}'> `;
}
export function decoratePlatformSeoGeoHtml(
html,
{
origin = '',
pageUrl = '',
pageDirUrl = '',
canonicalEnabled = true,
jsonLdEnabled = true,
noindex = false,
meta = {},
} = {},
) {
const source = String(html ?? '');
let next = upsertDescriptionMeta(source, meta.description ?? buildMindspaceGeoPayload(source).summary);
next = upsertMindspaceGeoMeta(next, meta.geo ?? buildMindspaceGeoPayload(next));
next = injectOgTags(next, {
origin,
pageUrl,
pageDirUrl,
siteName: meta.siteName ?? PLATFORM_SITE_NAME,
meta,
});
next = injectSeoTags(next, {
origin,
pageUrl,
pageDirUrl,
canonicalEnabled,
meta,
});
if (jsonLdEnabled) {
next = injectGeoTags(next, {
origin,
pageUrl,
pageDirUrl,
sourceHtml: next,
meta,
});
}
if (noindex) {
next = injectRobotsNoindex(next);
}
return next;
}
export const PLATFORM_STATIC_DISCOVERY_ENTRIES = [
{
publicUrl: '/learn/',
title: '我的学习小助手',
summary: 'TKMind 儿童学习打卡与习惯养成助手,支持任务清单、成长记录与家长协同。',
updatedAt: Date.parse('2026-09-16T00:00:00.000Z'),
},
];