Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

feat(website): publish stable bilingual discovery and source facts (#772)

tt-a1idbac5c10470d
diff --git a/archify/test/site-language-continuity.test.mjs b/archify/test/site-language-continuity.test.mjs
index 35cc74e9..46309e91 100644
--- a/archify/test/site-language-continuity.test.mjs
+++ b/archify/test/site-language-continuity.test.mjs
@@ -6,10 +6,12 @@ import http from 'node:http';
import os from 'node:os';
import path from 'node:path';
import vm from 'node:vm';
-import { fileURLToPath } from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
import { ChromeVisualBrowser, findChrome } from '../bin/visual-check.mjs';
import { DIAGRAM_TYPES, DIAGRAM_TYPE_LABELS } from '../../scripts/site-copy.mjs';
+import { CASES } from '../../website/src/data/gallery-presentation.mjs';
+import { SCENARIO_RECIPES } from '../recipes/scenarios.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(__dirname, '../..');
@@ -73,21 +75,40 @@ async function evaluate(browser, sessionId, expression) {
return response.result?.value;
}
-async function navigate(browser, sessionId, url) {
+async function navigate(browser, sessionId, url, expectedUrl = url) {
const loaded = browser.cdp.waitFor('Page.loadEventFired', sessionId);
+ loaded.catch(() => {}); // Keep early rejection handled; the mandatory await below still fails.
const navigation = await browser.cdp.send('Page.navigate', { url }, sessionId);
if (navigation.errorText) throw new Error(`Chrome navigation failed: ${navigation.errorText}`);
- await loaded;
+ try { await loaded; }
+ catch (error) { throw new Error(`Page load failed while navigating to ${url} (expected ${expectedUrl}): ${error.message}`, { cause: error }); }
+ if (expectedUrl !== url) {
+ for (let attempt = 0; attempt < 100; attempt++) {
+ try {
+ const settled = await evaluate(browser, sessionId, `location.href === ${JSON.stringify(expectedUrl)} && document.readyState === 'complete' && !!document.querySelector('.site-nav')`);
+ if (settled) return;
+ } catch (_) { /* A compatibility redirect destroys the previous execution context. */ }
+ await new Promise(resolve => setTimeout(resolve, 20));
+ }
+ const actual = await evaluate(browser, sessionId, '({ href: location.href, readyState: document.readyState })');
+ assert.fail(`Compatibility navigation did not settle at ${expectedUrl}; actual ${JSON.stringify(actual)}`);
+ }
}
async function clickAndNavigate(browser, sessionId, selector) {
+ const context = await evaluate(browser, sessionId, `({ from: location.href, to: document.querySelector(${JSON.stringify(selector)})?.href || null })`);
const loaded = browser.cdp.waitFor('Page.loadEventFired', sessionId);
- await evaluate(browser, sessionId, `(function () {
- var link = document.querySelector(${JSON.stringify(selector)});
- if (!link) throw new Error('Missing navigation link: ' + ${JSON.stringify(selector)});
- link.click();
- })()`);
- await loaded;
+ loaded.catch(() => {});
+ try {
+ await evaluate(browser, sessionId, `(function () {
+ var link = document.querySelector(${JSON.stringify(selector)});
+ if (!link) throw new Error('Missing navigation link: ' + ${JSON.stringify(selector)});
+ link.click();
+ })()`);
+ await loaded;
+ } catch (error) {
+ throw new Error(`Navigation click ${selector} from ${context.from} to ${context.to} failed: ${error.message}`, { cause: error });
+ }
}
function startStaticServer(root, basePath = '') {
@@ -97,7 +118,11 @@ function startStaticServer(root, basePath = '') {
response.writeHead(404).end('Not found');
return;
}
- const relative = decodeURIComponent(requestUrl.pathname.slice(basePath.length)).replace(/^\/+/, '') || 'index.html';
+ let relative;
+ try { relative = decodeURIComponent(requestUrl.pathname.slice(basePath.length)).replace(/^\/+/, '') || 'index.html'; }
+ catch (_) { response.writeHead(400).end('Bad request'); return; }
+ // Only the ten published pages have extensionless aliases; unknown routes stay 404.
+ if (process.env.ARCHIFY_SITE_ROOT && /^(?:zh|(?:zh\/)?(?:guide|start|gallery|community))$/.test(relative)) relative += '.html';
const requestedPath = path.resolve(root, relative);
if (!requestedPath.startsWith(`${path.resolve(root)}${path.sep}`)) {
response.writeHead(403).end('Forbidden');
@@ -385,6 +410,8 @@ test('real Chrome preserves language through entry, navigation, selection, refre
skip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real site regression.',
timeout: 120000,
}, async () => {
+ const builtSite = !!process.env.ARCHIFY_SITE_ROOT;
+ const chineseLang = builtSite ? 'zh-Hans' : 'zh-CN';
const docsRoot = process.env.ARCHIFY_SITE_ROOT ? path.resolve(process.env.ARCHIFY_SITE_ROOT) : path.join(repoRoot, 'docs');
const basePath = process.env.ARCHIFY_SITE_ROOT ? (process.env.ARCHIFY_SITE_BASE ?? '/archify') : '';
const server = startStaticServer(docsRoot, basePath);
@@ -392,9 +419,61 @@ test('real Chrome preserves language through entry, navigation, selection, refre
const address = server.address();
const baseUrl = `http://127.0.0.1:${address.port}${basePath}`;
const browser = new ChromeVisualBrowser(chromePath);
+ const cloudflare = builtSite && basePath === '';
+ // Expectations are independent of the production URL helper.
+ const pageHref = (page, language = 'en') => {
+ if (!builtSite) return page;
+ if (page === 'index.html') return language === 'zh' ? (cloudflare ? 'zh' : 'zh.html') : './';
+ return (language === 'zh' ? 'zh/' : '') + (cloudflare ? page.replace(/\.html$/, '') : page);
+ };
+ const pageUrl = (page, language = 'en', suffix = '') => new URL(pageHref(page, language) + suffix, `${baseUrl}/`).href;
+ const navSelector = (page, language) => `.site-nav a[href="${pageHref(page, language)}"]`;
+ async function assertBuiltNavigation(sessionId, page, language, rootUrl = `${baseUrl}/`) {
+ const receipt = await evaluate(browser, sessionId, `({
+ base: document.querySelector('base').getAttribute('href'),
+ resolvedBase: document.baseURI,
+ links: [...document.querySelectorAll('.site-nav .nav-link')].filter(link => !link.href.startsWith('https://github.com/')).map(link => ({ raw: link.getAttribute('href'), resolved: link.href })),
+ assets: [...document.querySelectorAll('.nav-logo img[src^="assets/"]')].map(image => ({ url: image.src, loaded: image.complete && image.naturalWidth > 0 })),
+ icon: document.querySelector('link[rel="icon"]').href,
+ logo: document.querySelector('.site-nav .nav-logo').href,
+ emphasis: [...document.querySelectorAll('h1 em')].map(node => ({
+ style: getComputedStyle(node).fontStyle, weight: getComputedStyle(node).fontWeight,
+ family: getComputedStyle(node).fontFamily, headingFamily: getComputedStyle(node.closest('h1')).fontFamily
+ }))
+ })`);
+ if (page !== 'start.html') {
+ assert.ok(receipt.emphasis.length > 0, `${page}: heading emphasis exists`);
+ for (const emphasis of receipt.emphasis) {
+ assert.equal(emphasis.style, language === 'zh' ? 'normal' : 'italic', `${page} ${language}: localized heading emphasis style`);
+ assert.equal(emphasis.weight, language === 'zh' ? '600' : '400', `${page} ${language}: localized heading emphasis weight`);
+ if (language === 'zh') {
+ assert.equal(emphasis.family, emphasis.headingFamily, `${page}: Chinese emphasis inherits its heading family`);
+ assert.match(emphasis.family, /(?:^|,)\s*sans-serif\s*$/, `${page}: Chinese heading uses the portable sans-serif stack`);
+ }
+ }
+ }
+ assert.equal(receipt.base, language === 'zh' && page !== 'index.html' ? '../' : './', `${page}: relative export base`);
+ assert.equal(receipt.resolvedBase, rootUrl, `${page}: resolved resource base`);
+ assert.deepEqual(receipt.links, ['guide.html', 'gallery.html', 'start.html', 'community.html'].map(target => ({
+ raw: pageHref(target, language), resolved: new URL(pageHref(target, language), rootUrl).href,
+ })), `${page} ${language}: exact resolved navigation routes`);
+ assert.equal(receipt.logo, new URL(pageHref('index.html', language) + (page === 'index.html' ? '#' : ''), rootUrl).href, `${page}: localized home link`);
+ assert.equal(receipt.icon, new URL('assets/archify-mark.svg', rootUrl).href, `${page}: favicon uses resource base`);
+ assert.ok(receipt.assets.length > 0, `${page}: brand resource exists`);
+ for (const asset of receipt.assets) {
+ assert.ok(asset.url.startsWith(new URL('assets/', rootUrl).href), `${page}: resource URL belongs to root assets`);
+ assert.ok(asset.loaded, `${page}: brand image loaded`);
+ }
+ }
try {
const sessionId = await browser.sessionPromise;
+ if (builtSite) {
+ for (const unknown of ['/missing-page', '/zh/missing-page', '/zh/guide/extra']) {
+ assert.equal((await fetch(`${baseUrl}${unknown}`)).status, 404, `${unknown}: unknown routes never receive a page fallback`);
+ }
+ assert.equal((await fetch(`${baseUrl}/%2e%2e%2foutside.html`)).status, 403, 'encoded path traversal is blocked');
+ }
await browser.cdp.send('Emulation.setDeviceMetricsOverride', {
width: 1440,
height: 900,
@@ -402,18 +481,93 @@ test('real Chrome preserves language through entry, navigation, selection, refre
mobile: false,
}, sessionId);
+ if (builtSite) {
+ const staticContent = {
+ 'index.html': ['.hero h1', '.hero h1 .l', '.hero-sub', '.fade-up', '.product-facts h2', '.product-facts article h3', '.product-facts article p'],
+ 'gallery.html': ['.hero h1', '.hero-copy', '.showcase-card', '.showcase-card .card-title', '.showcase-card .card-description'],
+ 'community.html': ['.hero h1', '.hero-copy', '.package-card', '.package-name', '.package-summary'],
+ };
+ await browser.cdp.send('Emulation.setScriptExecutionDisabled', { value: true }, sessionId);
+ try {
+ for (const language of ['en', 'zh']) for (const [page, selectors] of Object.entries(staticContent)) {
+ await navigate(browser, sessionId, pageUrl(page, language));
+ // CSS entrance animations can still be in progress at Page.loadEventFired.
+ // Wait for their actual completion; decorative infinite animations are unrelated.
+ await evaluate(browser, sessionId, `(async function () {
+ var animations = document.getAnimations().filter(function (animation) {
+ return animation.effect && Number.isFinite(animation.effect.getComputedTiming().endTime);
+ });
+ var deadline;
+ try {
+ await Promise.race([
+ Promise.all(animations.map(function (animation) { return animation.finished; })),
+ new Promise(function (_, reject) {
+ deadline = setTimeout(function () { reject(new Error('Finite CSS animations did not finish within 5 seconds')); }, 5000);
+ })
+ ]);
+ } finally { clearTimeout(deadline); }
+ })()`);
+ const receipt = await evaluate(browser, sessionId, `(function () {
+ return {
+ language: document.documentElement.lang,
+ runtimeAbsent: typeof window.ArchifySiteLanguage === 'undefined',
+ enhancedNodes: document.querySelectorAll('.fade-up.visible, .showcase-card.visible, .package-card.visible').length,
+ groups: ${JSON.stringify(selectors)}.map(function (selector) {
+ return { selector, nodes: [...document.querySelectorAll(selector)].map(function (node) {
+ var style = getComputedStyle(node), box = node.getBoundingClientRect();
+ var ancestorsVisible = true;
+ for (var ancestor = node.parentElement; ancestor; ancestor = ancestor.parentElement) {
+ var parentStyle = getComputedStyle(ancestor);
+ if (Number(parentStyle.opacity) !== 1 || parentStyle.display === 'none' || parentStyle.visibility !== 'visible') ancestorsVisible = false;
+ }
+ return { text: node.textContent.trim().length, opacity: Number(style.opacity), display: style.display, visibility: style.visibility, width: box.width, height: box.height, ancestorsVisible };
+ }) };
+ })
+ };
+ })()`);
+ assert.equal(receipt.language, language === 'zh' ? chineseLang : 'en', `${page} ${language}: static language`);
+ assert.ok(receipt.runtimeAbsent, `${page} ${language}: site JavaScript must remain disabled`);
+ assert.equal(receipt.enhancedNodes, 0, `${page} ${language}: visibility cannot depend on adding .visible`);
+ for (const group of receipt.groups) {
+ assert.ok(group.nodes.length > 0, `${page} ${language}: static ${group.selector} exists`);
+ for (const node of group.nodes) {
+ const label = `${page} ${language} ${group.selector}: static content is visible without JavaScript`;
+ assert.ok(node.text > 0, label);
+ assert.equal(node.opacity, 1, label);
+ assert.notEqual(node.display, 'none', label);
+ assert.equal(node.visibility, 'visible', label);
+ assert.ok(node.width > 0 && node.height > 0 && node.ancestorsVisible, label);
+ }
+ }
+ }
+ } finally {
+ await browser.cdp.send('Emulation.setScriptExecutionDisabled', { value: false }, sessionId);
+ }
+ }
+
await navigate(browser, sessionId, `${baseUrl}/index.html`);
await evaluate(browser, sessionId, 'localStorage.clear()');
await evaluate(browser, sessionId, "localStorage.setItem('archify-guide-language', 'zh')");
await navigate(browser, sessionId, `${baseUrl}/index.html`);
- assert.deepEqual(await evaluate(browser, sessionId, `({
- language: document.documentElement.lang,
- stored: localStorage.getItem('archify-lang')
- })`), { language: 'zh-CN', stored: 'zh' });
+ if (builtSite) {
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'en', 'English URL wins over legacy storage');
+ await evaluate(browser, sessionId, "localStorage.setItem('archify-lang', 'zh')");
+ await navigate(browser, sessionId, pageUrl('index.html'));
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'en', 'English URL wins over canonical storage');
+ await evaluate(browser, sessionId, 'localStorage.clear()');
+ await navigate(browser, sessionId, pageUrl('index.html', 'zh'));
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), chineseLang, 'Bare Chinese URL is Chinese without storage');
+ assert.equal(await evaluate(browser, sessionId, 'document.querySelector("link[rel=canonical]").href'), 'https://archify.si/zh');
+ } else {
+ assert.deepEqual(await evaluate(browser, sessionId, `({
+ language: document.documentElement.lang,
+ stored: localStorage.getItem('archify-lang')
+ })`), { language: chineseLang, stored: 'zh' });
+ }
await evaluate(browser, sessionId, 'localStorage.clear()');
- await navigate(browser, sessionId, `${baseUrl}/index.html?lang=zh&utm_source=browser-test#proof`);
+ await navigate(browser, sessionId, `${baseUrl}/index.html?lang=zh&utm_source=browser-test#proof`, builtSite ? pageUrl('index.html', 'zh', '?utm_source=browser-test#proof') : undefined);
let state = await evaluate(browser, sessionId, `({
language: document.documentElement.lang,
@@ -423,15 +577,15 @@ test('real Chrome preserves language through entry, navigation, selection, refre
hash: location.hash
})`);
assert.deepEqual(state, {
- language: 'zh-CN', stored: 'zh', langQuery: null, campaign: 'browser-test', hash: '#proof',
+ language: chineseLang, stored: 'zh', langQuery: null, campaign: 'browser-test', hash: '#proof',
});
- await clickAndNavigate(browser, sessionId, '.site-nav a[href="gallery.html"]');
- assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'zh-CN');
+ await clickAndNavigate(browser, sessionId, navSelector('gallery.html', 'zh'));
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), chineseLang);
assert.equal(await evaluate(browser, sessionId, 'document.querySelector(".nav-logo-path").textContent'), '/ 验证作品集');
assert.deepEqual(await evaluate(browser, sessionId, `Array.from(document.querySelectorAll('[data-filter]')).map(function (button) {
return button.textContent;
- })`), ['全部配方 / 11', '架构图', '工作流', '时序图', '数据流', '生命周期']);
+ })`), [`全部配方 / ${CASES.length}`, ...DIAGRAM_TYPES.map(type => DIAGRAM_TYPE_LABELS.zh[type])]);
await evaluate(browser, sessionId, 'document.querySelector(\'[data-filter="architecture"]\').click()');
state = await evaluate(browser, sessionId, `({
@@ -444,7 +598,7 @@ test('real Chrome preserves language through entry, navigation, selection, refre
})
})`);
assert.deepEqual(state, {
- language: 'zh-CN', selected: 'true', typeQuery: 'architecture', visibleCount: 2, onlyArchitecture: true,
+ language: chineseLang, selected: 'true', typeQuery: 'architecture', visibleCount: 2, onlyArchitecture: true,
});
let loaded = browser.cdp.waitFor('Page.loadEventFired', sessionId);
@@ -454,34 +608,47 @@ test('real Chrome preserves language through entry, navigation, selection, refre
language: document.documentElement.lang,
selected: document.querySelector('[data-filter="architecture"]').getAttribute('aria-pressed'),
visibleCount: document.querySelectorAll('.showcase-card:not([hidden])').length
- })`), { language: 'zh-CN', selected: 'true', visibleCount: 2 });
-
- await evaluate(browser, sessionId, 'document.getElementById("language").click()');
+ })`), { language: chineseLang, selected: 'true', visibleCount: 2 });
+
+ if (builtSite) {
+ await evaluate(browser, sessionId, "history.replaceState(null, '', location.pathname + '?type=architecture&utm_source=switch#proof')");
+ assert.equal(await evaluate(browser, sessionId, 'document.querySelector("[data-language-switch]").tagName'), 'A');
+ await clickAndNavigate(browser, sessionId, '[data-language-switch]');
+ assert.equal(await evaluate(browser, sessionId, 'location.href'), pageUrl('gallery.html', 'en', '?type=architecture&utm_source=switch#proof'));
+ assert.equal(await evaluate(browser, sessionId, `document.querySelector('[data-filter="architecture"]').getAttribute('aria-pressed')`), 'true');
+ await clickAndNavigate(browser, sessionId, '[data-language-switch]');
+ assert.equal(await evaluate(browser, sessionId, 'location.href'), pageUrl('gallery.html', 'zh', '?type=architecture&utm_source=switch#proof'));
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), chineseLang);
+ await clickAndNavigate(browser, sessionId, '[data-language-switch]');
+ assert.equal(await evaluate(browser, sessionId, 'location.href'), pageUrl('gallery.html', 'en', '?type=architecture&utm_source=switch#proof'));
+ } else {
+ await evaluate(browser, sessionId, 'document.getElementById("language").click()');
+ }
assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'en');
assert.equal(await evaluate(browser, sessionId, 'document.querySelector(".nav-logo-path").textContent'), '/ proof lab');
assert.deepEqual(await evaluate(browser, sessionId, `Array.from(document.querySelectorAll('[data-filter]')).map(function (button) {
return button.textContent;
- })`), ['All / 11', 'Architecture', 'Workflow', 'Sequence', 'Data flow', 'Lifecycle']);
+ })`), [`All / ${CASES.length}`, ...DIAGRAM_TYPES.map(type => DIAGRAM_TYPE_LABELS.en[type])]);
loaded = browser.cdp.waitFor('Page.loadEventFired', sessionId);
await browser.cdp.send('Page.reload', {}, sessionId);
await loaded;
assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'en');
- await clickAndNavigate(browser, sessionId, '.site-nav a[href="guide.html"]');
+ await clickAndNavigate(browser, sessionId, navSelector('guide.html', 'en'));
assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'en');
- await navigate(browser, sessionId, `${baseUrl}/guide.html?lang=zh#recipes`);
+ await navigate(browser, sessionId, `${baseUrl}/guide.html?lang=zh#recipes`, builtSite ? pageUrl('guide.html', 'zh', '#recipes') : undefined);
state = await evaluate(browser, sessionId, `({
language: document.documentElement.lang,
stored: localStorage.getItem('archify-lang'),
langQuery: new URL(location.href).searchParams.get('lang'),
hash: location.hash
})`);
- assert.deepEqual(state, { language: 'zh-CN', stored: 'zh', langQuery: null, hash: '#recipes' });
+ assert.deepEqual(state, { language: chineseLang, stored: 'zh', langQuery: null, hash: '#recipes' });
assert.equal(await evaluate(browser, sessionId, 'document.querySelector(".nav-logo-path").textContent'), '/ 场景指南');
assert.deepEqual(await evaluate(browser, sessionId, `Array.from(document.querySelectorAll('#filters [data-filter]')).map(function (button) {
return button.textContent;
- })`), ['全部配方', '架构图', '工作流', '时序图', '数据流', '生命周期']);
+ })`), ['全部配方', ...DIAGRAM_TYPES.map(type => DIAGRAM_TYPE_LABELS.zh[type])]);
await evaluate(browser, sessionId, 'document.querySelector(\'#filters [data-filter="sequence"]\').click()');
state = await evaluate(browser, sessionId, `({
@@ -496,24 +663,69 @@ test('real Chrome preserves language through entry, navigation, selection, refre
})
})`);
assert.deepEqual(state, {
- language: 'zh-CN',
+ language: chineseLang,
selected: true,
visibleCount: 2,
onlySequence: true,
- labels: ['全部配方', '架构图', '工作流', '时序图', '数据流', '生命周期'],
+ labels: ['全部配方', ...DIAGRAM_TYPES.map(type => DIAGRAM_TYPE_LABELS.zh[type])],
});
- await clickAndNavigate(browser, sessionId, '.site-nav a[href="start.html"]');
- assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'zh-CN');
+ if (builtSite) {
+ const question = 'Guide draft continuity: approval workflow with reviewer handoff 审核交接';
+ const suffix = '?utm_source=guide-state&type=workflow#recipes';
+ await navigate(browser, sessionId, pageUrl('guide.html', 'en'));
+ // A filter or campaign can change the URL after the switch link first initializes.
+ await evaluate(browser, sessionId, `history.replaceState(null, '', location.pathname + ${JSON.stringify(suffix)})`);
+ const workflowRecipes = SCENARIO_RECIPES.filter(recipe => recipe.type === 'workflow');
+ assert.ok(workflowRecipes.length > 0, 'canonical inventory includes workflow recipes');
+ const selectedRecipe = { id: workflowRecipes[0].id, en: workflowRecipes[0].en.title, zh: workflowRecipes[0].zh.title };
+ assert.equal(await evaluate(browser, sessionId, `(function () {
+ document.getElementById('scenario').value = ${JSON.stringify(question)};
+ document.querySelector('#filters [data-filter="workflow"]').click();
+ var card = document.querySelector('#cards .card[data-recipe]');
+ card.click();
+ return card.dataset.recipe;
+ })()`), selectedRecipe.id, 'first workflow card matches the canonical recipe inventory');
+ for (const language of ['zh', 'en']) {
+ await clickAndNavigate(browser, sessionId, '[data-language-switch]');
+ assert.equal(await evaluate(browser, sessionId, 'location.href'), pageUrl('guide.html', language, suffix));
+ assert.deepEqual(await evaluate(browser, sessionId, `({
+ language: document.documentElement.lang,
+ scenario: document.getElementById('scenario').value,
+ filter: document.querySelector('#filters .filter.active').dataset.filter,
+ visibleCount: document.querySelectorAll('#cards .card').length,
+ onlyWorkflow: [...document.querySelectorAll('#cards .card-type')].every(node => node.textContent === 'workflow'),
+ selectedCardExists: !!document.querySelector('#cards .card[data-recipe="${selectedRecipe.id}"]'),
+ resultVisible: document.getElementById('result').classList.contains('visible'),
+ title: document.querySelector('#result h3').textContent,
+ pendingState: sessionStorage.getItem('archify-guide-language-state.v1')
+ })`), {
+ language: language === 'zh' ? chineseLang : 'en', scenario: question, filter: 'workflow',
+ visibleCount: workflowRecipes.length, onlyWorkflow: true, selectedCardExists: true, resultVisible: true,
+ title: selectedRecipe[language], pendingState: null,
+ }, `${language}: Guide language navigation preserves the draft, filter and selected recipe and consumes temporary state`);
+ assert.equal(await evaluate(browser, sessionId, 'new URL(location.href).searchParams.has("scenario")'), false, 'Guide draft stays out of the URL');
+ }
+ await navigate(browser, sessionId, pageUrl('guide.html', 'zh', '#recipes'));
+ }
+
+ await clickAndNavigate(browser, sessionId, navSelector('start.html', 'zh'));
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), chineseLang);
assert.equal(await evaluate(browser, sessionId, 'new URL(location.href).searchParams.has("lang")'), false);
assert.equal(await evaluate(browser, sessionId, 'document.querySelector(".nav-logo-path").textContent'), '/ 快速上手');
+ if (builtSite) {
+ await navigate(browser, sessionId, pageUrl('start.html', 'zh', '?lang=en&utm_source=legacy#install'), pageUrl('start.html', 'en', '?utm_source=legacy&type=architecture&agent=codex&source=direct&input=description#install'));
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), 'en');
+ assert.equal(await evaluate(browser, sessionId, 'localStorage.getItem("archify-lang")'), 'en');
+ }
const pages = ['index.html', 'gallery.html', 'guide.html', 'start.html'];
if (fs.existsSync(path.join(docsRoot, 'community.html'))) pages.push('community.html');
if (process.env.ARCHIFY_SITE_ROOT) assert.ok(pages.includes('community.html'), 'built site must include the catalog');
const desktopReceipts = [];
for (const page of pages) {
- await navigate(browser, sessionId, `${baseUrl}/${page}`);
+ await navigate(browser, sessionId, builtSite ? pageUrl(page, 'zh') : `${baseUrl}/${page}`);
+ if (builtSite) await assertBuiltNavigation(sessionId, page, 'zh');
desktopReceipts.push(await evaluate(browser, sessionId, `(function () {
var nav = document.querySelector('.site-nav');
var logo = nav.querySelector('.nav-logo-text');
@@ -539,7 +751,7 @@ test('real Chrome preserves language through entry, navigation, selection, refre
ctaHeight: cta.getBoundingClientRect().height,
ctaRadius: ctaStyle.borderRadius,
linkCount: nav.querySelectorAll('.nav-link').length,
- communityLabel: nav.querySelector('a[href="community.html"]').textContent.trim()
+ communityLabel: nav.querySelector(${JSON.stringify('a[href="' + pageHref('community.html', 'zh') + '"]')}).textContent.trim()
};
})()`));
}
@@ -553,11 +765,12 @@ test('real Chrome preserves language through entry, navigation, selection, refre
}, sessionId);
for (const language of ['en', 'zh']) {
for (const page of pages) {
- await navigate(browser, sessionId, `${baseUrl}/${page}?lang=${language}`);
+ await navigate(browser, sessionId, builtSite ? pageUrl(page, language) : `${baseUrl}/${page}?lang=${language}`);
+ if (builtSite) await assertBuiltNavigation(sessionId, page, language);
const mobile = await evaluate(browser, sessionId, `(function () {
var nav = document.querySelector('.site-nav');
var rect = nav.getBoundingClientRect();
- var community = nav.querySelector('a[href="community.html"]');
+ var community = nav.querySelector(${JSON.stringify('a[href="' + pageHref('community.html', language) + '"]')});
var linkRect = community.getBoundingClientRect();
var x = linkRect.x + linkRect.width / 2;
var y = linkRect.y + linkRect.height / 2;
@@ -578,9 +791,9 @@ test('real Chrome preserves language through entry, navigation, selection, refre
assert.equal(mobile.left, 0, page);
assert.equal(mobile.right, width, page);
assert.ok(mobile.pageWidth <= width, `${page} ${language} ${width}: page must not overflow`);
- assert.equal(mobile.language, language === 'zh' ? 'zh-CN' : 'en', page);
+ assert.equal(mobile.language, language === 'zh' ? chineseLang : 'en', page);
assert.equal(mobile.communityLabel, language === 'zh' ? '社区包' : 'Community', page);
- assert.equal(mobile.active, page === 'index.html' ? null : page, page);
+ assert.equal(mobile.active, page === 'index.html' ? null : pageHref(page, language), page);
assert.ok(mobile.linksFit, `${page} ${language} ${width}: navigation must fit`);
assert.ok(mobile.reachable, `${page} ${language} ${width}: Community must be reachable`);
assert.ok(mobile.targetHeight >= 44, 'mobile navigation must retain a 44px touch target');
@@ -590,13 +803,25 @@ test('real Chrome preserves language through entry, navigation, selection, refre
await browser.cdp.send('Input.dispatchMouseEvent', { type, x: mobile.x, y: mobile.y, button: 'left', clickCount: 1 }, sessionId);
}
await loaded;
- assert.equal(await evaluate(browser, sessionId, 'location.pathname'), `${basePath}/community.html`);
- assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), language === 'zh' ? 'zh-CN' : 'en');
- assert.equal(await evaluate(browser, sessionId, 'document.querySelector(".site-nav a[aria-current=page]").getAttribute("href")'), 'community.html');
+ assert.equal(await evaluate(browser, sessionId, 'location.pathname'), new URL(pageUrl('community.html', language)).pathname);
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), language === 'zh' ? chineseLang : 'en');
+ assert.equal(await evaluate(browser, sessionId, 'document.querySelector(".site-nav a[aria-current=page]").getAttribute("href")'), pageHref('community.html', language));
}
}
}
}
+ if (builtSite && !cloudflare) {
+ // Exported GitHub HTML must resolve the same navigation and CSS on file://.
+ const fileRoot = pathToFileURL(`${docsRoot}${path.sep}`).href;
+ for (const language of ['en', 'zh']) {
+ for (const page of pages) {
+ const exported = page === 'index.html' && language === 'en' ? 'index.html' : pageHref(page, language);
+ await navigate(browser, sessionId, new URL(exported, fileRoot).href);
+ assert.equal(await evaluate(browser, sessionId, 'document.documentElement.lang'), language === 'zh' ? chineseLang : 'en');
+ await assertBuiltNavigation(sessionId, page, language, fileRoot);
+ }
+ }
+ }
} finally {
await browser.close();
await new Promise((resolve) => server.close(resolve));
diff --git a/website/README.md b/website/README.md
index 1207668b..a68676e5 100644
--- a/website/README.md
+++ b/website/README.md
@@ -21,7 +21,7 @@ TypeScript stays on the supported 6.x line because the Astro checker currently r
## Source ownership
-- `src/pages/*.astro`: the four website pages, retaining `index.html`, `gallery.html`, `guide.html`, and `start.html` URLs.
+- `src/pages/*.astro`: five English pages and reusable Chinese route wrappers. Existing English file URLs remain available; the Chinese homepage builds as `zh.html`, with four pages under `zh/`.
- `src/layouts/SiteLayout.astro` and `src/components/Navigation.astro`: shared document and navigation.
- `src/components/Brand.tsx`: shared server-rendered React identity; no unnecessary hydration is shipped. Future interactive React components can opt into Astro client directives.
- `src/components/GalleryCard.astro` and `src/data/gallery-presentation.mjs`: shared gallery presentation. The existing artifact builder imports the same card renderer and curated case metadata.
@@ -76,3 +76,13 @@ Cut over in this order:
For rollback, disable the Cloudflare deployment variable and roll back to the last verified Pages deployment; keep the old GitHub site available. Record DNS before any cutover so changes can be reversed deliberately. Removing a project is not a rollback: first detach custom domains and their DNS records to avoid dangling destinations.
The migration visual receipt is in `test/evidence/visual-parity.json`. Full-page comparisons use identical browser/viewports and wait for fonts. Animation is frozen and iframe pixels are hidden in both versions; iframe files are instead verified byte-for-byte, and unmasked pages are inspected separately.
+
+## Search and AI discovery
+
+The ten main language pages contain their translated body text, metadata and recipe references before JavaScript runs. Language links navigate to real URLs; URL language takes precedence over stored preferences. Existing `?lang=` entry links migrate to the matching route and preserve other parameters and fragments. Guide drafts survive a language switch once in session storage, expire after 30 seconds, and are never placed in the URL or sent over the network.
+
+`src/data/site-urls.mjs` defines the preferred `https://archify.si` URLs for both hosts. Each language has its own canonical and reciprocal `en`/`zh-Hans`/`x-default` links. GitHub Pages retains its `/archify` resource paths while pointing search engines to the official domain. Release identity and recipes come from this checkout: stable and development builds must not advertise each other's capabilities.
+
+The build produces `robots.txt` and `sitemap.xml` from the ten pages and the curated gallery inventory. It checks each advertised artifact's original manifest hashes before adding an explicitly marked metadata block in the deployed HTML head; exported source files, SVG, scripts and updater bytes retain their existing contracts. Source JSON remains accessible and receives `X-Robots-Tag: noindex` on Cloudflare. GitHub Pages cannot set that response header. Robots rules allow crawling these evidence URLs so their indexing headers can be read.
+
+After publication, verify the actual Cloudflare response, including any managed robots rules, redirects, sitemap URLs and headers. Submit the deployed sitemap to verified Google Search Console and Bing Webmaster Tools properties, then inspect real crawl and index results. Google AI controls, search impressions and Bing AI citation reports are separate account observations; successful builds and submissions do not establish rankings or AI citations. Avoid fabricated ratings, install statistics or daily sitemap modification dates. Search access and AI training permissions are independent decisions.
diff --git a/website/astro.config.mjs b/website/astro.config.mjs
index 1d6ce3fe..87dd2923 100644
--- a/website/astro.config.mjs
+++ b/website/astro.config.mjs
@@ -3,8 +3,14 @@ import react from '@astrojs/react';
import tailwindcss from '@tailwindcss/vite';
import { writeFileSync } from 'node:fs';
import { siteTarget } from './scripts/site-target.mjs';
+import { publishSeo } from './scripts/publish-seo.mjs';
+import { fileURLToPath } from 'node:url';
const target = siteTarget();
+const publishSearchMetadata = {
+ name: 'archify-publish-search-metadata',
+ hooks: { 'astro:build:done': ({ dir }) => publishSeo(fileURLToPath(dir), target) },
+};
const cloudflareNotFound = {
name: 'archify-cloudflare-not-found',
hooks: {
@@ -22,6 +28,6 @@ export default defineConfig({
publicDir: './.public',
compressHTML: false,
build: { format: 'file' },
- integrations: [react(), ...(target.name === 'cloudflare' ? [cloudflareNotFound] : [])],
+ integrations: [react(), publishSearchMetadata, ...(target.name === 'cloudflare' ? [cloudflareNotFound] : [])],
vite: { plugins: [tailwindcss()] },
});
diff --git a/website/public/0e4ac4a253b420619eb3de08ba664736.txt b/website/public/0e4ac4a253b420619eb3de08ba664736.txt
new file mode 100644
index 00000000..3c7df014
--- /dev/null
+++ b/website/public/0e4ac4a253b420619eb3de08ba664736.txt
@@ -0,0 +1 @@
+0e4ac4a253b420619eb3de08ba664736
\ No newline at end of file
diff --git a/website/public/fonts/fonts.css b/website/public/fonts/fonts.css
new file mode 100644
index 00000000..1e6667c5
--- /dev/null
+++ b/website/public/fonts/fonts.css
@@ -0,0 +1,126 @@
+/* Official Google Fonts Latin subsets; unmodified WOFF2. Licenses and source hashes: sources.json. */
+@font-face {
+ font-family: 'Fraunces';
+ font-style: italic;
+ font-weight: 400;
+ font-display: swap;
+ src: url(./fraunces-italic-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Fraunces';
+ font-style: normal;
+ font-weight: 300;
+ font-display: swap;
+ src: url(./fraunces-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Fraunces';
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ src: url(./fraunces-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Fraunces';
+ font-style: normal;
+ font-weight: 500;
+ font-display: swap;
+ src: url(./fraunces-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Inter';
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ src: url(./inter-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Inter';
+ font-style: normal;
+ font-weight: 450;
+ font-display: swap;
+ src: url(./inter-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Inter';
+ font-style: normal;
+ font-weight: 500;
+ font-display: swap;
+ src: url(./inter-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Inter';
+ font-style: normal;
+ font-weight: 600;
+ font-display: swap;
+ src: url(./inter-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'JetBrains Mono';
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ src: url(./jetbrains-mono-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'JetBrains Mono';
+ font-style: normal;
+ font-weight: 500;
+ font-display: swap;
+ src: url(./jetbrains-mono-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'JetBrains Mono';
+ font-style: normal;
+ font-weight: 600;
+ font-display: swap;
+ src: url(./jetbrains-mono-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Space Grotesk';
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ src: url(./space-grotesk-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Space Grotesk';
+ font-style: normal;
+ font-weight: 500;
+ font-display: swap;
+ src: url(./space-grotesk-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+@font-face {
+ font-family: 'Space Grotesk';
+ font-style: normal;
+ font-weight: 600;
+ font-display: swap;
+ src: url(./space-grotesk-normal-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
diff --git a/website/public/fonts/fraunces-OFL.txt b/website/public/fonts/fraunces-OFL.txt
new file mode 100644
index 00000000..e0a3ac7d
--- /dev/null
+++ b/website/public/fonts/fraunces-OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2018 The Fraunces Project Authors (https://github.com/undercasetype/Fraunces)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/website/public/fonts/fraunces-italic-latin.woff2 b/website/public/fonts/fraunces-italic-latin.woff2
new file mode 100644
index 00000000..88d409d3
Binary files /dev/null and b/website/public/fonts/fraunces-italic-latin.woff2 differ
diff --git a/website/public/fonts/fraunces-normal-latin.woff2 b/website/public/fonts/fraunces-normal-latin.woff2
new file mode 100644
index 00000000..4c7b557f
Binary files /dev/null and b/website/public/fonts/fraunces-normal-latin.woff2 differ
diff --git a/website/public/fonts/inter-OFL.txt b/website/public/fonts/inter-OFL.txt
new file mode 100644
index 00000000..909a6bf9
--- /dev/null
+++ b/website/public/fonts/inter-OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/website/public/fonts/inter-normal-latin.woff2 b/website/public/fonts/inter-normal-latin.woff2
new file mode 100644
index 00000000..91dc3e85
Binary files /dev/null and b/website/public/fonts/inter-normal-latin.woff2 differ
diff --git a/website/public/fonts/jetbrains-mono-normal-latin.woff2 b/website/public/fonts/jetbrains-mono-normal-latin.woff2
new file mode 100644
index 00000000..2ca6ac60
Binary files /dev/null and b/website/public/fonts/jetbrains-mono-normal-latin.woff2 differ
diff --git a/website/public/fonts/jetbrainsmono-OFL.txt b/website/public/fonts/jetbrainsmono-OFL.txt
new file mode 100644
index 00000000..821a3dac
--- /dev/null
+++ b/website/public/fonts/jetbrainsmono-OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+
+This license is copied below, and is also available with a FAQ at: https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/website/public/fonts/sources.json b/website/public/fonts/sources.json
new file mode 100644
index 00000000..e1af221e
--- /dev/null
+++ b/website/public/fonts/sources.json
@@ -0,0 +1,76 @@
+{
+ "cssSource": "https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,400&family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap",
+ "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
+ "cssSha256": "44cd1d301367aaa546559484be54ae67474b18e8816b008d40d48d40126f110c",
+ "licenseCommit": "2eb0b48d5f760f62e286216f0859a8c540dbc1bd",
+ "fonts": [
+ {
+ "file": "fraunces-italic-latin.woff2",
+ "source": "https://fonts.gstatic.com/s/fraunces/v38/6NUs8FyLNQOQZAnv9ZwNjucMHVn85Ni7emAe9lKqZTnbB-gzTK0K1ChJdt9hFwpX9W37ll9_mv0iQublWII.woff2",
+ "bytes": 42144,
+ "sha256": "f0c442fc4162c260ac42d234ec0f715e38977ca9e7da6a9703bbe003875c9692"
+ },
+ {
+ "file": "fraunces-normal-latin.woff2",
+ "source": "https://fonts.gstatic.com/s/fraunces/v38/6NU78FyLNQOQZAnv9bYEvDiIdE9Ea92uemAk_WBq8U_9v0c2Wa0KxC9TeP2Xz5c.woff2",
+ "bytes": 67388,
+ "sha256": "48282a415ec22e31beaf0a0666e6fae0c8cbddcd0b1f6e729f27c3ade8a64e43"
+ },
+ {
+ "file": "inter-normal-latin.woff2",
+ "source": "https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7W0Q5nw.woff2",
+ "bytes": 48432,
+ "sha256": "c940764593d0fe5d596be327ca7558855e018039fb78509aa21921fd3644c3e4"
+ },
+ {
+ "file": "jetbrains-mono-normal-latin.woff2",
+ "source": "https://fonts.gstatic.com/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwgknk-4.woff2",
+ "bytes": 31340,
+ "sha256": "2c32b9b3ee358c119e210f6f5195f9bd34894d78a785ff2e95d60e718e400af4"
+ },
+ {
+ "file": "space-grotesk-normal-latin.woff2",
+ "source": "https://fonts.gstatic.com/s/spacegrotesk/v22/V8mDoQDjQSkFtoMM3T6r8E7mPbF4C_k3HqU.woff2",
+ "bytes": 22320,
+ "sha256": "a0d054c4af557de20afd6ca59f47ab353bcaec49c63ff04b6c9d39d0f8910557"
+ }
+ ],
+ "licenses": [
+ {
+ "file": "fraunces-OFL.txt",
+ "source": "https://raw.githubusercontent.com/google/fonts/2eb0b48d5f760f62e286216f0859a8c540dbc1bd/ofl/fraunces/OFL.txt",
+ "bytes": 4390,
+ "sha256": "6732d6cc72c5d09292ff754dc1f39d9ea14918f74e87a17afa3f00a5120c3d48",
+ "sourceBytes": 4391,
+ "sourceSha256": "bdf4c22802eaf804f998195871c6b8938aac2ac14b2d78a8bd66a6f1eced833b",
+ "normalization": "LF line endings and removal of trailing whitespace only; license text unchanged"
+ },
+ {
+ "file": "inter-OFL.txt",
+ "source": "https://raw.githubusercontent.com/google/fonts/2eb0b48d5f760f62e286216f0859a8c540dbc1bd/ofl/inter/OFL.txt",
+ "bytes": 4376,
+ "sha256": "5dd548d31a85f756e01d63e00d7faf1e324103ed3e9102fcbbabf2cc2db6dd39",
+ "sourceBytes": 4377,
+ "sourceSha256": "5b9321a4298cfeb6b34354164a1c3afc3db114569984c502b9b35d988fd58c57",
+ "normalization": "LF line endings and removal of trailing whitespace only; license text unchanged"
+ },
+ {
+ "file": "spacegrotesk-OFL.txt",
+ "source": "https://raw.githubusercontent.com/google/fonts/2eb0b48d5f760f62e286216f0859a8c540dbc1bd/ofl/spacegrotesk/OFL.txt",
+ "bytes": 4401,
+ "sha256": "18a4de52385f6b988782639d5d0cc1326e5a8c2de9a7f01d7b20d9aedcc60943",
+ "sourceBytes": 4495,
+ "sourceSha256": "564ce565c371c5e5bbf286006565a7c9aa55a9f56e7ca58d56e05d649dd61a72",
+ "normalization": "LF line endings and removal of trailing whitespace only; license text unchanged"
+ },
+ {
+ "file": "jetbrainsmono-OFL.txt",
+ "source": "https://raw.githubusercontent.com/google/fonts/2eb0b48d5f760f62e286216f0859a8c540dbc1bd/ofl/jetbrainsmono/OFL.txt",
+ "bytes": 4399,
+ "sha256": "b2fe5e8987594e9ffd1d2ca52a2f5d73eb8335243893c5d6254b5ad69269591d",
+ "sourceBytes": 4399,
+ "sourceSha256": "b2fe5e8987594e9ffd1d2ca52a2f5d73eb8335243893c5d6254b5ad69269591d",
+ "normalization": "LF line endings and removal of trailing whitespace only; license text unchanged"
+ }
+ ]
+}
diff --git a/website/public/fonts/space-grotesk-normal-latin.woff2 b/website/public/fonts/space-grotesk-normal-latin.woff2
new file mode 100644
index 00000000..7b0e76a5
Binary files /dev/null and b/website/public/fonts/space-grotesk-normal-latin.woff2 differ
diff --git a/website/public/fonts/spacegrotesk-OFL.txt b/website/public/fonts/spacegrotesk-OFL.txt
new file mode 100644
index 00000000..d5666d70
--- /dev/null
+++ b/website/public/fonts/spacegrotesk-OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/website/scripts/check-cloudflare-output.mjs b/website/scripts/check-cloudflare-output.mjs
index 504b7ccc..82fa65e3 100644
--- a/website/scripts/check-cloudflare-output.mjs
+++ b/website/scripts/check-cloudflare-output.mjs
@@ -7,7 +7,7 @@ import { parse } from 'parse5';
// Check the deployable files, not only the build configuration. Pages needs a
// top-level 404 to disable its implicit single-page-app fallback.
export function checkCloudflareOutput(root) {
- const pages = ['index.html', 'gallery.html', 'guide.html', 'start.html', 'community.html', '404.html'];
+ const pages = ['index.html', 'gallery.html', 'guide.html', 'start.html', 'community.html', 'zh.html', 'zh/gallery.html', 'zh/guide.html', 'zh/start.html', 'zh/community.html', '404.html'];
let fileCount = 0;
const checkAssets = directory => {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
@@ -27,10 +27,16 @@ export function checkCloudflareOutput(root) {
}
for (const page of pages) {
const source = fs.readFileSync(path.join(root, page), 'utf8');
+ const document = parse(source);
+ const findBase = node => node.tagName === 'base'
+ ? node.attrs?.find(attribute => attribute.name === 'href')?.value
+ : (node.childNodes ?? []).map(findBase).find(Boolean);
+ const documentUrl = `https://archify.si/${page}`;
+ const baseUrl = new URL(findBase(document) || documentUrl, documentUrl);
const visit = node => {
for (const { name, value } of node.attrs ?? []) {
if (!['src', 'href'].includes(name) || !value || value.startsWith('#')) continue;
- const url = new URL(value, `https://archify.si/${page}`);
+ const url = new URL(value, baseUrl);
if (url.origin !== 'https://archify.si') continue;
const pathname = decodeURIComponent(url.pathname);
assert.ok(!/^\/archify(?:\/|$)/.test(pathname), `${page}: legacy base URL ${value}`);
@@ -43,8 +49,24 @@ export function checkCloudflareOutput(root) {
}
for (const child of node.childNodes ?? []) visit(child);
};
- visit(parse(source));
+ visit(document);
}
+ const sitemap = fs.readFileSync(path.join(root, 'sitemap.xml'), 'utf8');
+ const locations = [...sitemap.matchAll(/<loc>([^<]+)<\/loc>/g)].map(match => match[1]);
+ assert.ok(locations.length >= 10, 'Sitemap must include both languages');
+ assert.equal(new Set(locations).size, locations.length, 'Duplicate sitemap URL');
+ for (const location of locations) {
+ const url = new URL(location);
+ assert.equal(url.origin, 'https://archify.si');
+ assert.ok(!url.search && !url.hash && !/\.html$/.test(url.pathname), `Noncanonical sitemap URL: ${location}`);
+ const relative = url.pathname.slice(1);
+ const file = !relative || relative.endsWith('/') ? `${relative}index.html` : `${relative}.html`;
+ const html = fs.readFileSync(path.join(root, file), 'utf8');
+ assert.ok(html.includes(`rel="canonical" href="${location}"`), `Missing matching canonical: ${location}`);
+ assert.ok(!/<meta[^>]+(?:name="robots"[^>]+content="[^"]*noindex|content="[^"]*noindex[^>]+name="robots")/i.test(html), `Noindex sitemap page: ${location}`);
+ }
+ assert.equal(fs.readFileSync(path.join(root, 'robots.txt'), 'utf8').includes('Sitemap: https://archify.si/sitemap.xml'), true);
+ assert.match(fs.readFileSync(path.join(root, '_headers'), 'utf8'), /\/\*\.json\n X-Robots-Tag: noindex/);
const builtManifest = fs.readFileSync(path.join(root, 'skill-updates/archify/stable.json'));
const canonicalManifest = fs.readFileSync(new URL('../../docs/skill-updates/archify/stable.json', import.meta.url));
assert.ok(builtManifest.equals(canonicalManifest), 'The static site must retain the exact stable update manifest');
diff --git a/website/scripts/indexnow.mjs b/website/scripts/indexnow.mjs
new file mode 100644
index 00000000..17757637
--- /dev/null
+++ b/website/scripts/indexnow.mjs
@@ -0,0 +1,76 @@
+import fs from 'node:fs';
+import { pathToFileURL } from 'node:url';
+import { canonicalOrigin, canonicalUrl, sitePages } from '../src/data/site-urls.mjs';
+import { CASES } from '../src/data/gallery-presentation.mjs';
+
+export const key = '0e4ac4a253b420619eb3de08ba664736';
+export const keyLocation = `${canonicalOrigin}/${key}.txt`;
+export const sitemapLocation = `${canonicalOrigin}/sitemap.xml`;
+export const endpoint = 'https://api.indexnow.org/indexnow';
+const allowedUrls = new Set([
+ ...sitePages.flatMap(page => ['en', 'zh'].map(lang => canonicalUrl(page, lang))),
+ ...CASES.map(entry => `${canonicalOrigin}/gallery/artifacts/${entry.output.replace(/\.html$/, '')}`),
+]);
+const requireValue = (ok, message) => { if (!ok) throw new Error(message); };
+
+// Parse the deliberately small XML vocabulary emitted by publish-seo. Fail
+// closed on sitemap indexes, DTDs, unexpected elements or malformed entities.
+export function parseSitemap(xml) {
+ requireValue(Buffer.byteLength(xml) <= 1024 * 1024, 'Sitemap exceeds 1 MiB');
+ const root = xml.trim().replace(/^<\?xml\s+[^?]*\?>\s*/, '').match(/^<urlset\s+xmlns="http:\/\/www\.sitemaps\.org\/schemas\/sitemap\/0\.9"\s*>([\s\S]*)<\/urlset>$/);
+ requireValue(root, 'Expected a standard sitemap urlset XML document');
+ const entries = [];
+ let body = root[1];
+ while (body.trim()) {
+ const item = body.match(/^\s*<url>\s*<loc>([^<]+)<\/loc>\s*<\/url>/);
+ requireValue(item, 'Malformed sitemap URL entry');
+ const value = item[1].replace(/&(?:amp|lt|gt|quot|apos);/g, entity => ({ '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&apos;': "'" })[entity]);
+ requireValue(!/&(?:#\w+|\w+);/.test(value), 'Unsupported XML entity');
+ const url = new URL(value);
+ requireValue(url.protocol === 'https:' && url.host === 'archify.si' && !url.username && !url.password && !url.search && !url.hash, `Noncanonical host or URL: ${value}`);
+ requireValue(url.href === value && allowedUrls.has(value), `URL outside the published page/artifact inventory: ${value}`);
+ requireValue(!entries.includes(value), `Duplicate sitemap URL: ${value}`);
+ entries.push(value);
+ body = body.slice(item[0].length);
+ }
+ requireValue(entries.length === allowedUrls.size, 'Sitemap must contain all ten main pages and selected gallery artifacts');
+ return entries;
+}
+
+async function readPublic(url, fetchImpl) {
+ const response = await fetchImpl(url, { redirect: 'error', signal: AbortSignal.timeout(10000) });
+ requireValue(response.status === 200, `Public preflight failed: ${url} HTTP ${response.status}`);
+ const text = await response.text();
+ requireValue(Buffer.byteLength(text) <= 1024 * 1024, `Public response exceeds 1 MiB: ${url}`);
+ return text;
+}
+
+export async function notifyIndexNow({ submit = false, fetchImpl = fetch } = {}) {
+ const localKey = fs.readFileSync(new URL(`../public/${key}.txt`, import.meta.url), 'utf8');
+ requireValue(localKey.trim() === key, 'Public key file does not match the configured key');
+ const urlList = parseSitemap(await readPublic(sitemapLocation, fetchImpl));
+ const payload = { host: 'archify.si', key, keyLocation, urlList };
+ if (!submit) return { status: 'dry-run', endpoint, payload };
+ const hostedKey = await readPublic(keyLocation, fetchImpl);
+ requireValue(hostedKey.trim() === key, 'Deployed IndexNow key file does not match');
+ const response = await fetchImpl(endpoint, {
+ method: 'POST', redirect: 'error', signal: AbortSignal.timeout(10000),
+ headers: { 'Content-Type': 'application/json; charset=utf-8' },
+ body: JSON.stringify(payload),
+ });
+ requireValue(response.status === 200 || response.status === 202, `IndexNow notification failed: HTTP ${response.status}`);
+ return { status: response.status === 200 ? 'accepted' : 'queued-key-validation', httpStatus: response.status, urlCount: urlList.length, indexed: false };
+}
+
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+ const args = process.argv.slice(2);
+ if (args.some(arg => !['--submit', '--help'].includes(arg))) {
+ console.error('Usage: node website/scripts/indexnow.mjs [--submit]');
+ process.exitCode = 1;
+ } else if (args.includes('--help')) {
+ console.log('Default: fetch the deployed sitemap and print the payload without POST.\nAfter deployment: node website/scripts/indexnow.mjs --submit\n200 means received; 202 means received with key validation pending. Neither confirms indexing.\nProtocol: https://www.indexnow.org/documentation');
+ } else {
+ try { console.log(JSON.stringify(await notifyIndexNow({ submit: args.includes('--submit') }), null, 2)); }
+ catch (error) { console.error(error.message); process.exitCode = 1; }
+ }
+}
diff --git a/website/scripts/publish-seo.mjs b/website/scripts/publish-seo.mjs
new file mode 100644
index 00000000..ffd57193
--- /dev/null
+++ b/website/scripts/publish-seo.mjs
@@ -0,0 +1,72 @@
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import path from 'node:path';
+import { createHash } from 'node:crypto';
+import { canonicalOrigin, canonicalUrl, canonicalPath, sitePages } from '../src/data/site-urls.mjs';
+import { CASES } from '../src/data/gallery-presentation.mjs';
+
+export const CANONICAL_ORIGIN = canonicalOrigin;
+export const SEO_BLOCK_START = '<!-- archify:published-artifact-metadata:start -->';
+export const SEO_BLOCK_END = '<!-- archify:published-artifact-metadata:end -->';
+const sha256 = value => createHash('sha256').update(value).digest('hex');
+const escape = value => String(value).replace(/[&<>"']/g, char => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[char]);
+
+// This narrowly scoped removal lets byte-parity checks retain the standalone
+// renderer contract while allowing publication-only discovery metadata.
+export function stripPublishedArtifactMetadata(html) {
+ return html.replace(/<!-- archify:published-artifact-metadata:start -->\n[\s\S]*?<!-- archify:published-artifact-metadata:end -->\n/g, '');
+}
+
+export function artifactMetadata(entry, presentation) {
+ const url = `${CANONICAL_ORIGIN}/${entry.artifact.replace(/\.html$/, '')}`;
+ const source = `${CANONICAL_ORIGIN}/${entry.input}`;
+ const data = {
+ '@context': 'https://schema.org', '@type': 'CreativeWork',
+ name: presentation.titleEn, description: presentation.descriptionEn,
+ url, isBasedOn: source, inLanguage: 'en',
+ };
+ return `${SEO_BLOCK_START}\n<link rel="canonical" href="${escape(url)}">\n<meta name="description" content="${escape(presentation.descriptionEn)}">\n<meta property="og:type" content="article">\n<meta property="og:title" content="${escape(presentation.titleEn)}">\n<meta property="og:description" content="${escape(presentation.descriptionEn)}">\n<meta property="og:url" content="${escape(url)}">\n<script type="application/ld+json">${JSON.stringify(data).replaceAll('<', '\\u003c')}</script>\n${SEO_BLOCK_END}\n`;
+}
+
+// Only gallery entries with passing artifact checks and unchanged proof hashes
+// are advertised. The manifest remains a receipt for the original export bytes.
+export function selectedArtifacts(root) {
+ const manifest = JSON.parse(fs.readFileSync(path.join(root, 'gallery/manifest.json'), 'utf8'));
+ return CASES.map(presentation => {
+ const entry = manifest.entries.find(item => item.id === presentation.id);
+ assert.ok(entry, `Missing gallery proof: ${presentation.id}`);
+ assert.equal(entry.artifact, `gallery/artifacts/${presentation.output}`);
+ assert.equal(entry.input, `gallery/sources/${presentation.input}`);
+ assert.ok(entry.checks.length > 0 && entry.checks.every(check => check.ok === true), `Unproven artifact: ${entry.id}`);
+ const html = fs.readFileSync(path.join(root, entry.artifact), 'utf8');
+ assert.equal(sha256(stripPublishedArtifactMetadata(html)), entry.artifactSha256, `Artifact proof hash mismatch: ${entry.id}`);
+ assert.equal(sha256(fs.readFileSync(path.join(root, entry.input))), entry.sourceSha256, `Source proof hash mismatch: ${entry.id}`);
+ return { entry, presentation };
+ });
+}
+
+export function publishSeo(root, target) {
+ const paths = sitePages.flatMap(page => ['en', 'zh'].map(lang => canonicalPath(page, lang).slice(1)));
+ for (const route of paths) {
+ const file = route === '' || route.endsWith('/') ? `${route}index.html` : `${route}.html`;
+ assert.ok(fs.existsSync(path.join(root, file)), `Missing indexable page: ${file}`);
+ }
+ const selected = selectedArtifacts(root);
+ for (const { entry, presentation } of selected) {
+ const file = path.join(root, entry.artifact);
+ const original = stripPublishedArtifactMetadata(fs.readFileSync(file, 'utf8'));
+ assert.match(original, /<\/head>/i, `Artifact missing head: ${entry.id}`);
+ fs.writeFileSync(file, original.replace(/<\/head>/i, `${artifactMetadata(entry, presentation)}</head>`));
+ }
+ const urls = [
+ ...sitePages.flatMap(page => ['en', 'zh'].map(lang => canonicalUrl(page, lang))),
+ ...selected.map(({ entry }) => `${CANONICAL_ORIGIN}/${entry.artifact.replace(/\.html$/, '')}`),
+ ];
+ fs.writeFileSync(path.join(root, 'sitemap.xml'), `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${urls.map(url => ` <url><loc>${escape(url)}</loc></url>`).join('\n')}\n</urlset>\n`);
+ fs.writeFileSync(path.join(root, 'robots.txt'), `User-agent: *\nAllow: /\n\nSitemap: ${CANONICAL_ORIGIN}/sitemap.xml\n`);
+ // Static Pages supports these response headers; GitHub Pages does not.
+ if (target.name === 'cloudflare') {
+ fs.writeFileSync(path.join(root, '_headers'), `/*.json\n X-Robots-Tag: noindex\n`);
+ }
+ return urls;
+}
diff --git a/website/src/components/Navigation.astro b/website/src/components/Navigation.astro
index 3846b624..1f8e83c1 100644
--- a/website/src/components/Navigation.astro
+++ b/website/src/components/Navigation.astro
@@ -32,7 +32,7 @@ const links = [
<svg class="theme-moon" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M13.5 9.6A5.8 5.8 0 0 1 6.4 2.5a5.8 5.8 0 1 0 7.1 7.1Z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>
<svg class="theme-sun" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.4"/><path d="M8 1.2v1.6M8 13.2v1.6M1.2 8h1.6M13.2 8h1.6M3.2 3.2l1.1 1.1M11.7 11.7l1.1 1.1M3.2 12.8l1.1-1.1M11.7 4.3l1.1-1.1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
</button>
- <button class={home ? 'btn btn-lang' : 'btn-lang'} id={home ? 'btn-lang' : 'language'} type={home ? undefined : 'button'} aria-label={home ? undefined : 'Switch language'}>中文</button>
+ <a class={home ? 'btn btn-lang' : 'btn-lang'} id={home ? 'btn-lang' : 'language'} href="zh/" data-language-switch aria-label="切换到中文">中文</a>
<a class="btn btn-primary nav-cta" href={home ? '#quickstart' : page === 'start' ? '#install' : 'start.html'} {...(home ? { 'data-i18n': 'nav-install' } : page === 'guide' ? { 'data-i18n': 'navInstall' } : { 'data-en': 'Install Skill', 'data-zh': '安装技能' })}>Install Skill</a>
</div>
</nav>
diff --git a/website/src/components/ProductFacts.astro b/website/src/components/ProductFacts.astro
new file mode 100644
index 00000000..4c554211
--- /dev/null
+++ b/website/src/components/ProductFacts.astro
@@ -0,0 +1,45 @@
+---
+const facts = [
+ {
+ question: ['What is Archify?', 'Archify 是什么?'],
+ answer: ['Archify is an open-source Agent Skill for turning a system, process, or plan into a diagram. The agent authors typed JSON, then Archify renders and validates a self-contained interactive HTML artifact. The Skill and renderers are licensed under MIT.', 'Archify 是一个开源 Agent Skill,把系统、流程或计划变成图表。Agent 编写类型化 JSON,再由 Archify 渲染、校验并交付独立的交互 HTML 成品。Skill 和渲染器采用 MIT 许可证。'],
+ },
+ {
+ question: ['What can I provide as input?', '可以提供哪些输入?'],
+ answer: ['Start with a plain-language description, a plan, existing Mermaid text, or repository evidence. A repository is optional. Your agent interprets the input and creates Archify JSON; Archify does not promise automatic parsing of every Mermaid construct. Missing facts should be marked or clarified.', '可以从自然语言描述、计划、已有 Mermaid 文本或代码库证据开始,代码库并非必需。Agent 理解输入后创建 Archify JSON;Archify 不承诺自动解析全部 Mermaid 语法。缺失的事实应标明或进一步确认。'],
+ },
+ {
+ question: ['Which agents can use it?', '哪些 Agent 可以使用?'],
+ answer: ['The installation examples cover Claude Code, Codex, Cursor, OpenCode, and GitHub Copilot. They use the same Archify Skill. Agent access to files, a local Node.js runtime, and any tools needed for the requested export remain part of your environment.', '安装示例覆盖 Claude Code、Codex、Cursor、OpenCode 和 GitHub Copilot,它们使用同一份 Archify Skill。Agent 的文件权限、本地 Node.js 运行时,以及所选导出功能需要的工具,由你的使用环境提供。'],
+ },
+ {
+ question: ['What do I receive, and what are the limits?', '会得到什么?有哪些边界?'],
+ answer: ['The primary deliverable is an HTML file with inline SVG and its typed JSON source. Open the HTML in a browser to inspect, search, trace routes, switch themes, and export. Validation checks the authored diagram; it does not prove runtime system behavior. Archify is not a hosted collaboration service or a general-purpose WYSIWYG editor.', '主要交付物是内含 SVG 的 HTML 文件和类型化 JSON 源。在浏览器里可以检查、搜索、追踪路径、切换主题和导出。校验检查的是编写出的图表,不证明系统的实际运行行为。Archify 不提供托管协作服务,也不是通用的所见即所得编辑器。'],
+ },
+];
+---
+<section class="product-facts" id="about-archify" aria-labelledby="product-facts-title">
+ <div class="container">
+ <div class="facts-heading"><span class="section-eyebrow" data-en="Product facts" data-zh="产品事实">Product facts</span><h2 id="product-facts-title" data-en="A diagram you can inspect and keep." data-zh="一张能检查、能保留的图。">A diagram you can inspect and keep.</h2></div>
+ <div class="facts-grid">
+ {facts.map(fact => <article><h3 data-en={fact.question[0]} data-zh={fact.question[1]}>{fact.question[0]}</h3><p data-en={fact.answer[0]} data-zh={fact.answer[1]}>{fact.answer[0]}</p></article>)}
+ </div>
+ <p class="facts-exports" data-en="Exports include PNG, JPEG, WebP, SVG, and WebM. Availability depends on the format and browser or local tooling; open a proof artifact to check the export menu before choosing a delivery format." data-zh="导出格式包含 PNG、JPEG、WebP、SVG 和 WebM。具体可用性取决于格式、浏览器或本地工具;选择交付格式前,可先打开成品检查导出菜单。">Exports include PNG, JPEG, WebP, SVG, and WebM. Availability depends on the format and browser or local tooling; open a proof artifact to check the export menu before choosing a delivery format.</p>
+ <nav class="facts-links" aria-label="Product sources">
+ <a href="https://github.com/tt-a1i/archify/blob/main/archify/SKILL.md" data-en="Read the stable Skill ↗" data-zh="阅读稳定版 Skill ↗">Read the stable Skill ↗</a>
+ <a href="https://github.com/tt-a1i/archify/releases" data-en="Published releases ↗" data-zh="已发布版本 ↗">Published releases ↗</a>
+ <a href="https://github.com/tt-a1i/archify/blob/main/LICENSE" data-en="MIT license ↗" data-zh="MIT 许可证 ↗">MIT license ↗</a>
+ <a href="gallery.html" data-en="Inspect real artifacts →" data-zh="检查真实成品 →">Inspect real artifacts →</a>
+ </nav>
+ <p class="facts-channel" data-en="The default installation command uses the stable main source. Development examples describe their own build and may include features not yet in a stable release." data-zh="默认安装命令使用稳定版 main 源码。开发版示例反映各自的构建,可能包含尚未稳定发布的功能。">The default installation command uses the stable main source. Development examples describe their own build and may include features not yet in a stable release.</p>
+ </div>
+</section>
+<style>
+ .product-facts { padding:80px 0; border-top:1px solid var(--line); }
+ .facts-heading h2 { margin:12px 0 32px; font-size:clamp(28px,3vw,40px); line-height:1.2; }
+ .facts-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:30px 48px; }
+ h3 { font-size:17px; margin:0 0 10px; } p { font-size:14px; line-height:1.8; color:var(--text-2); }
+ .facts-exports { margin-top:28px; } .facts-links { display:flex; flex-wrap:wrap; gap:14px 24px; margin-top:20px; font-size:13px; }
+ .facts-links a { color:var(--accent,#72d9cd); text-decoration:none; } .facts-channel { font-size:12px; margin-top:20px; }
+ @media(max-width:680px) { .facts-grid { grid-template-columns:1fr; gap:24px; } .product-facts { padding:56px 0; } }
+</style>
diff --git a/website/src/components/RecipeReference.astro b/website/src/components/RecipeReference.astro
new file mode 100644
index 00000000..8744be1e
--- /dev/null
+++ b/website/src/components/RecipeReference.astro
@@ -0,0 +1,63 @@
+---
+import { recipeSourceUrl, productChannel } from '../data/product-facts';
+interface RecipeCopy {
+ title: string; question: string; summary: string; useWhen: string;
+ avoidWhen: string; include: string[]; prompt: string;
+}
+interface Props {
+ recipes: { id: string; type: string; proof?: string;
+ presentation: { preset: string; motion: string };
+ en: RecipeCopy; zh: RecipeCopy }[];
+}
+const { recipes } = Astro.props;
+const labels = {
+ use: ['Use when', '适用场景'], avoid: ['Avoid when', '不适用场景'],
+ evidence: ['Evidence to include', '必须包含的证据'], prompt: ['Copy-ready prompt', '可直接复制的提示词'],
+};
+---
+<section class="recipe-reference" id="recipe-reference" aria-labelledby="recipe-reference-title">
+ <div class="section-head">
+ <div><div class="lead-label" data-en="Read the complete recipes" data-zh="阅读完整配方">Read the complete recipes</div><h2 id="recipe-reference-title" data-en="One question. A clear evidence boundary." data-zh="一个问题,一份明确的证据边界。">One question. A clear evidence boundary.</h2></div>
+ <p data-en="These recipes come directly from this build's CLI source. Follow the source and proof links to inspect what each recommendation means." data-zh="这些配方直接来自当前构建的 CLI 源码。通过源码和成品链接,可以检查每条推荐的具体含义。">These recipes come directly from this build's CLI source. Follow the source and proof links to inspect what each recommendation means.</p>
+ </div>
+ <nav class="recipe-index" aria-label="Recipe reference">
+ {recipes.map(recipe => <a href={`#recipe-${recipe.id}`} data-en={recipe.en.title} data-zh={recipe.zh.title}>{recipe.en.title}</a>)}
+ </nav>
+ <div class="recipe-reference-grid">
+ {recipes.map(recipe => <article class="recipe-entry" id={`recipe-${recipe.id}`}>
+ <span class="recipe-mode">{recipe.type} · {recipe.presentation.preset}</span>
+ <h3><a href={`#recipe-${recipe.id}`} data-en={recipe.en.title} data-zh={recipe.zh.title}>{recipe.en.title}</a></h3>
+ <p class="recipe-question" data-en={recipe.en.question} data-zh={recipe.zh.question}>{recipe.en.question}</p>
+ <p data-en={recipe.en.summary} data-zh={recipe.zh.summary}>{recipe.en.summary}</p>
+ <dl>
+ <dt data-en={labels.use[0]} data-zh={labels.use[1]}>{labels.use[0]}</dt>
+ <dd data-en={recipe.en.useWhen} data-zh={recipe.zh.useWhen}>{recipe.en.useWhen}</dd>
+ <dt data-en={labels.avoid[0]} data-zh={labels.avoid[1]}>{labels.avoid[0]}</dt>
+ <dd data-en={recipe.en.avoidWhen} data-zh={recipe.zh.avoidWhen}>{recipe.en.avoidWhen}</dd>
+ </dl>
+ <h4 data-en={labels.evidence[0]} data-zh={labels.evidence[1]}>{labels.evidence[0]}</h4>
+ <ul>{recipe.en.include.map((item, index) => <li data-en={item} data-zh={recipe.zh.include[index]}>{item}</li>)}</ul>
+ <h4 data-en={labels.prompt[0]} data-zh={labels.prompt[1]}>{labels.prompt[0]}</h4>
+ <p class="recipe-reference-prompt" data-en={recipe.en.prompt} data-zh={recipe.zh.prompt}>{recipe.en.prompt}</p>
+ <div class="recipe-reference-links">
+ <a href={recipeSourceUrl} data-en={`${productChannel === 'development' ? 'Development' : 'Stable'} recipe source ↗`} data-zh={`${productChannel === 'development' ? '开发版' : '稳定版'}配方源码 ↗`}>{productChannel === 'development' ? 'Development' : 'Stable'} recipe source ↗</a>
+ {recipe.proof && <a href={`gallery.html#proof-${recipe.proof}`} data-en="Inspect generated proof ↗" data-zh="检查生成成品 ↗">Inspect generated proof ↗</a>}
+ <a href={`start.html?type=${recipe.type}`} data-en="Start with this diagram type →" data-zh="从这种图表类型开始 →">Start with this diagram type →</a>
+ </div>
+ </article>)}
+ </div>
+</section>
+<style>
+ .recipe-reference { margin: 72px 0; scroll-margin-top: 100px; }
+ .recipe-index { display:flex; flex-wrap:wrap; gap:8px 18px; margin:24px 0; font-size:13px; }
+ .recipe-index a,.recipe-reference-links a { color:var(--hue-cyan,#5dcfd3); text-decoration:none; }
+ .recipe-reference-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
+ .recipe-entry { border:1px solid var(--line); border-radius:16px; padding:26px; scroll-margin-top:100px; min-width:0; }
+ .recipe-mode { font-size:11px; letter-spacing:.08em; text-transform:uppercase; opacity:.65; }
+ h3 { margin:10px 0; font-size:22px; } h3 a { color:inherit; text-decoration:none; }
+ p, dd, li { font-size:14px; line-height:1.65; } p { opacity:.8; } .recipe-question { opacity:1; }
+ dt,h4 { margin:18px 0 6px; font-size:12px; font-weight:700; } dd { margin:0; opacity:.75; }
+ ul { padding-left:20px; } .recipe-reference-prompt { background:rgba(120,140,160,.07); padding:16px; border-radius:8px; overflow-wrap:anywhere; }
+ .recipe-reference-links { display:flex; flex-wrap:wrap; gap:12px; font-size:12px; margin-top:18px; }
+ @media(max-width:760px) { .recipe-reference-grid { grid-template-columns:1fr; } .recipe-entry { padding:20px; } }
+</style>
diff --git a/website/src/data/community-head.html b/website/src/data/community-head.html
index 0da9d99b..9e4f4901 100644
--- a/website/src/data/community-head.html
+++ b/website/src/data/community-head.html
@@ -6,6 +6,4 @@
<meta name="description" content="A curated catalog of standalone community packages that build on Archify: skill packs, recipe libraries, brand kits, locale packs, and CLI wrappers. Submitted by PR, validated deterministically.">
<meta name="theme-color" content="#07080a">
<link rel="icon" type="image/svg+xml" href="assets/archify-mark.svg">
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,400&family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <link href="fonts/fonts.css" rel="stylesheet">
diff --git a/website/src/data/default-proof-labels.mjs b/website/src/data/default-proof-labels.mjs
new file mode 100644
index 00000000..82a0c306
--- /dev/null
+++ b/website/src/data/default-proof-labels.mjs
@@ -0,0 +1,5 @@
+// Initial SSR copy and the interactive proof reader share these authored labels.
+export const defaultProofLabels = {
+ meta: { en: 'Workflow · Signal Flow · 12 nodes · 11 edges', zh: '工作流 · Signal Flow · 12 节点 · 11 条关系' },
+ title: { en: 'Agent Tool Call — policy, execution, recovery, and evidence', zh: '智能体工具调用——策略、执行、恢复与证据闭环' },
+};
diff --git a/website/src/data/gallery-head.html b/website/src/data/gallery-head.html
index a933337c..5f8a3e9e 100644
--- a/website/src/data/gallery-head.html
+++ b/website/src/data/gallery-head.html
@@ -6,6 +6,4 @@
<meta name="description" content="A generated gallery of validated, self-contained Archify diagrams. Every preview links to its exact JSON source and interactive HTML artifact.">
<meta name="theme-color" content="#07080a">
<link rel="icon" type="image/svg+xml" href="assets/archify-mark.svg">
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,400&family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <link href="fonts/fonts.css" rel="stylesheet">
diff --git a/website/src/data/guide-head.html b/website/src/data/guide-head.html
index e69dc2ea..b026ce5f 100644
--- a/website/src/data/guide-head.html
+++ b/website/src/data/guide-head.html
@@ -6,6 +6,4 @@
<meta name="description" content="Describe the technical question you need to answer. Archify recommends a bounded diagram recipe, evidence checklist, and copy-ready prompt.">
<meta name="theme-color" content="#07080a">
<link rel="icon" type="image/svg+xml" href="assets/archify-mark.svg">
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,400&family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <link href="fonts/fonts.css" rel="stylesheet">
diff --git a/website/src/data/index-head.html b/website/src/data/index-head.html
index 0e5727ed..a1b0ccf1 100644
--- a/website/src/data/index-head.html
+++ b/website/src/data/index-head.html
@@ -12,7 +12,4 @@
<meta property="og:image" content="https://tt-a1i.github.io/archify/assets/archify-social-preview.png">
<meta property="og:url" content="https://tt-a1i.github.io/archify/">
<meta name="twitter:card" content="summary_large_image">
-
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,400&family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <link href="fonts/fonts.css" rel="stylesheet">
diff --git a/website/src/data/localize-html.mjs b/website/src/data/localize-html.mjs
new file mode 100644
index 00000000..eff83e37
--- /dev/null
+++ b/website/src/data/localize-html.mjs
@@ -0,0 +1,42 @@
+import { parseFragment, serialize } from 'parse5';
+import { localPagePath } from './site-urls.mjs';
+
+export function localizeHtml(html, { lang, page, cloudflare, copy = {} }) {
+ const tree = parseFragment(html);
+ function walk(node) {
+ const attrs = new Map((node.attrs || []).map(item => [item.name, item]));
+ const get = name => attrs.get(name)?.value;
+ const set = (name, value) => {
+ if (attrs.has(name)) attrs.get(name).value = value;
+ else { const attr = { name, value }; node.attrs.push(attr); attrs.set(name, attr); }
+ };
+ if (node.tagName === 'script' && get('src') === 'assets/site-language.js') {
+ node.parentNode.childNodes = node.parentNode.childNodes.filter(child => child !== node);
+ return;
+ }
+ const key = get('data-i18n') || get('data-i18n-html');
+ const value = key ? copy[lang]?.[key] : get(`data-${lang}`);
+ if (typeof value === 'string') {
+ // Only authored dictionary strings or explicit markup may contain HTML.
+ const markup = key || get('data-translation-html') !== undefined || page === 'gallery';
+ node.childNodes = markup ? parseFragment(value).childNodes : [{ nodeName: '#text', value, parentNode: node }];
+ for (const child of node.childNodes) child.parentNode = node;
+ }
+ const placeholder = copy[lang]?.[get('data-i18n-placeholder')];
+ if (typeof placeholder === 'string') set('placeholder', placeholder);
+ if (get('data-language-switch') !== undefined) {
+ set('href', localPagePath(page, lang === 'zh' ? 'en' : 'zh', cloudflare));
+ set('hreflang', lang === 'zh' ? 'en' : 'zh-Hans');
+ set('aria-label', lang === 'zh' ? 'Switch to English' : '切换到中文');
+ node.childNodes = [{ nodeName: '#text', value: lang === 'zh' ? 'EN' : '中文', parentNode: node }];
+ } else if (node.tagName === 'a') {
+ const href = get('href');
+ const match = href?.match(/^(?:(index|guide|start|gallery|community)\.html|(\.\/))([?#].*)?$/);
+ if (match) set('href', localPagePath(match[1] || 'index', lang, cloudflare) + (match[3] || ''));
+ else if (href?.startsWith('#')) set('href', localPagePath(page, lang, cloudflare) + href);
+ }
+ for (const child of [...(node.childNodes || [])]) walk(child);
+ }
+ walk(tree);
+ return serialize(tree);
+}
diff --git a/website/src/data/product-facts.ts b/website/src/data/product-facts.ts
new file mode 100644
index 00000000..bf8cf860
--- /dev/null
+++ b/website/src/data/product-facts.ts
@@ -0,0 +1,8 @@
+import release from '../../../archify/skill-release.json';
+
+// The release identity belongs to this checkout; no stable capability is inferred
+// from a development recipe or from the host where the site is deployed.
+export const productVersion = release.version;
+export const productChannel = release.channel === 'development' ? 'development' : 'stable';
+export const sourceRef = productChannel === 'development' ? 'dev' : 'main';
+export const recipeSourceUrl = `https://github.com/tt-a1i/archify/blob/${sourceRef}/archify/recipes/scenarios.mjs`;
diff --git a/website/src/data/site-metadata.mjs b/website/src/data/site-metadata.mjs
new file mode 100644
index 00000000..bb8223fc
--- /dev/null
+++ b/website/src/data/site-metadata.mjs
@@ -0,0 +1,33 @@
+import { canonicalUrl, canonicalOrigin } from './site-urls.mjs';
+const descriptions = {
+ index: {
+ en: ['Archify — AI Agent Skill for Interactive Diagrams', 'Archify is an MIT-licensed AI agent skill that creates validated, self-contained HTML diagrams from descriptions or source code, with interactive exploration and browser export.'],
+ zh: ['Archify — 用自然语言生成交互式图表', 'Archify 是采用 MIT 许可证的 AI Agent 技能,可从自然语言或源码生成经过验证的独立 HTML 图表,支持交互探索与浏览器导出。'],
+ },
+ guide: {
+ en: ['Archify Scenario Guide — Choose the Right Diagram', 'Choose a diagram recipe by the question you need to answer. Browse evidence checklists, use cases, boundaries, and copy-ready prompts from the Archify recipe source.'],
+ zh: ['Archify 场景指南 — 选择合适的图表', '从需要解释的问题出发选择图表配方,查看与 Archify 配方源码一致的场景、证据清单、使用边界和可复制提示词。'],
+ },
+ start: {
+ en: ['Archify Start — Create Your First Diagram', 'Install the Archify skill for your AI agent and create a diagram from a description or repository. Choose your agent, diagram type, and input to copy an appropriate command and prompt.'],
+ zh: ['Archify 快速上手 — 创建第一张图', '为你的 AI Agent 安装 Archify 技能,从自然语言或代码仓库创建图表。选择 Agent、图表类型和输入方式,复制对应的命令与提示词。'],
+ },
+ gallery: {
+ en: ['Archify Proof Lab — Validated Diagram Gallery', 'Explore validated Archify diagrams with interactive HTML artifacts, exact JSON sources, and recorded checks. Validation records and human visual review are shown separately.'],
+ zh: ['Archify 验证作品集 — 可探索的图表成品', '探索经过验证的 Archify 图表,查看交互式 HTML 成品、对应 JSON 源码与检查记录。自动验证与人工视觉评审分别列出。'],
+ },
+ community: {
+ en: ['Archify Community — Packages Built on Archify', 'Browse standalone community packages built on Archify, including skills, recipes, themes, locale packs, and CLI wrappers, with source, license, compatibility, and evidence links.'],
+ zh: ['Archify 社区 — 基于 Archify 的独立包', '浏览基于 Archify 的独立社区包,包括技能、配方、主题、语言包与 CLI 封装,并查看源码、许可证、兼容性和验证证据。'],
+ },
+};
+export function pageMetadata(page, lang, version) {
+ const [title, description] = descriptions[page][lang];
+ const canonical = canonicalUrl(page, lang);
+ return { title, description, canonical, image: `${canonicalOrigin}/assets/archify-social-preview.png`,
+ schema: { '@context': 'https://schema.org', '@graph': [
+ { '@type': 'WebSite', '@id': `${canonicalOrigin}/#website`, url: `${canonicalOrigin}/`, name: 'Archify', inLanguage: ['en', 'zh-Hans'] },
+ { '@type': 'SoftwareSourceCode', '@id': `${canonicalOrigin}/#source`, name: 'Archify', codeRepository: 'https://github.com/tt-a1i/archify', url: 'https://github.com/tt-a1i/archify', license: 'https://github.com/tt-a1i/archify/blob/main/LICENSE', version, programmingLanguage: 'JavaScript', description: descriptions.index[lang][1] },
+ ] },
+ };
+}
diff --git a/website/src/data/site-translations.mjs b/website/src/data/site-translations.mjs
new file mode 100644
index 00000000..556859f8
--- /dev/null
+++ b/website/src/data/site-translations.mjs
@@ -0,0 +1,196 @@
+export const indexCopy = {
+ en: {
+ 'label-life':'Beyond code',
+ 'life-h2':'Not just for code. <em>For anything with steps.</em>',
+ 'life-body':'Leave plans, job hunts, renting, a monthly budget — each one below is a real Archify artifact, generated and validated exactly like a system diagram. Open one and click around.',
+ 'life-note':'Numbers in these examples are illustrative. Describe your own situation and your agent draws yours.',
+ 'life-leave-k':'Workflow',
+ 'life-leave-q':'How should I spread my leave across the year?',
+ 'life-job-k':'Lifecycle',
+ 'life-job-q':'Where does each job application stand?',
+ 'life-money-k':'Data flow',
+ 'life-money-q':'Where does my paycheck go each month?',
+ 'life-rent-k':'Sequence',
+ 'life-rent-q':'Who says what when I rent a flat?',
+ 'arch-k':'Architecture',
+ 'wf-k':'Workflow',
+ 'seq-k':'Sequence',
+ 'flow-k':'Data flow',
+ 'life-k':'Lifecycle',
+ 'nav-guide':'Guide','nav-gallery':'Proof Lab','nav-start':'Start','nav-community':'Community','nav-install':'Install Skill',
+ 'hero-badge':"Development Agent Skill · see what's new",'hero-works':'Works with',
+ 'hero-h1':'<span class="l">Describe it in plain words.</span><span class="l">Get a map <em>you can trust.</em></span>',
+ 'hero-sub':'A leave plan, a job hunt, a monthly budget, or a software system — if it has steps, parts, relationships, or states, your AI agent turns it into one explorable HTML map, validated before it ships.',
+ 'hero-cta':'Get started','hero-stars':'stars on GitHub','copy':'Copy','copied':'Copied',
+ 'demo-watch':'Watch the 35s demo','demo-title':'Archify 35-second demo','demo-close':'Close demo',
+ 'tour-title':'Live artifact tour',
+ 'proof-live':'Live','proof-open':'Open artifact',
+ 'beat-0-k':'Map','beat-1-k':'Focus','beat-2-k':'Upstream','beat-3-k':'Lens',
+ 'beat-0-t':'The whole system, in one readable frame.','beat-0-b':'This is the real generated artifact, not a screenshot. Lanes, boundaries, and every authored edge — scroll to move its camera.',
+ 'beat-1-t':'Focus one node, see what it drives.','beat-1-b':'Press Enter on any node — or open a stable link — and the camera isolates everything downstream of it.',
+ 'beat-2-t':'Flip the reach. Find the cause.','beat-2-b':'Trace upstream to every dependency that feeds a step. Same file, same authored relationships, one hash change.',
+ 'beat-3-t':'Compare by meaning, not by box.','beat-3-b':'Lens keeps only the semantic kinds you name — security against data, backend against storage — and quiets the rest.',
+ 'stat-types':'Diagram types','stat-presets':'Visual presets','stat-checks':'Validation checks per artifact','stat-export':'Native export scale','stat-deps':'Runtime dependencies',
+ 'label-types':'Diagram types',
+ 'types-h2':'Five questions. <em>Five kinds of map.</em>',
+ 'types-body':'Ask the question you actually have. Archify picks the picture that answers it — for a software system, a plan, or something in your own life.',
+ 'types-more':'Browse the full proof gallery','types-more-sub':'Live artifacts · every preset · every type',
+ 'arch-h':'What is it made of?',
+ 'arch-p':'The parts of something and how they connect — a household\'s accounts and cards, a team\'s roles, or a cloud system\'s services, databases, and security boundaries.',
+ 'arch-li1':'Household accounts','arch-li2':'Team roles','arch-li3':'Microservices topology','arch-li4':'Cloud + security boundaries',
+ 'wf-h':'What happens next?',
+ 'wf-p':'Steps across people or stages — a visa application, a leave plan, onboarding, an approval chain, or a CI/CD pipeline, lane by lane.',
+ 'seq-h':'Who says what, in what order?',
+ 'seq-p':'Back-and-forth in order — renting a flat through an agent, an expense claim, or an API call chain with its returns.',
+ 'flow-h':'Where does it all go?',
+ 'flow-p':'Where something moves and where it lands — a paycheck into bills and savings, documents through review, or data through a pipeline.',
+ 'life-h':'Where does it stand now?',
+ 'life-p':'States and what moves between them — job applications, an order, a passport renewal, or a deployment — with waits, retries, and endings.',
+ 'label-features':'Output',
+ 'features-h2':'One file. <em>Everything inside.</em>',
+ 'cmp-light':'Light','cmp-dark':'Dark',
+ 'fv1-h':'Dual-theme output','fv1-p':"Every diagram ships with coordinated dark and light variable sets. The HTML theme toggle and the SVG @media prefers-color-scheme rule switch together — one file follows the reader's theme.",'fv1-tag':'LIGHT · DARK · ONE FILE',
+ 'fv2-h':'One menu, every format','fv2-p':'PNG, JPEG, WebP, dual-theme SVG, WebM motion, or straight to the clipboard — every export renders natively in the browser from the same menu.',
+ 'exp-clip-fmt':'Clipboard',
+ 'f2-h':'Ultra-crisp 4× export','f2-p':'PNG, JPEG, WebP — all rasterized natively at up to 4× source resolution by the browser. No upsampling blur. Sharp on retina displays, slides, and print.',
+ 'f5-h':'Self-contained HTML','f5-p':'One HTML file. Zero dependencies, no server, no runtime. Open it in any browser and it works. Share by attaching it to an email or PR comment.',
+ 'f6-h':'Iterate by chat','f6-p':'"Move the summer trip to August", "add Redis", "make the deadline red" — refine in plain words. No diagram editor to learn.',
+ 'f7-h':'Inspect and play real routes','f7-p':'Route Journey keeps the complete authored path visible while you inspect any stop or play one finite, reader-controlled pass over each exact incoming relationship.','f7-tag':'INSPECT · PLAY · PAUSE',
+ 'label-palette':'Design system',
+ 'palette-h2':'Color that <em>means something.</em>',
+ 'palette-body':'Seven node colours, consistent in both themes. The legend renames them for your story — Backend can read as Vacation, Security as Rule.',
+ 'chip-frontend':'Frontend','chip-frontend-use':'Client apps, browsers, mobile, UI',
+ 'chip-backend':'Backend','chip-backend-use':'Services, APIs, workers, daemons',
+ 'chip-database':'Database','chip-database-use':'DBs, caches, stores, AI/ML',
+ 'chip-cloud':'Cloud','chip-cloud-use':'Managed services, infra',
+ 'chip-security':'Security','chip-security-use':'Auth, secrets, guards',
+ 'chip-bus':'Message Bus','chip-bus-use':'Kafka, RabbitMQ, SNS',
+ 'chip-external':'External','chip-external-use':'Users, 3rd parties, generic',
+ 'label-qs':'Quick start',
+ 'qs-h2':'Three steps. <em>One command.</em>',
+ 'qs-body':'One checked Skill for Claude Code, Codex, Cursor, OpenCode, and GitHub Copilot. Pick your agent for the exact command.',
+ 'term-c1':'# Install globally for your agent','term-c2':'# Or try it once with Codex, no permanent install','term-c3':'# Then just ask',
+ 'term-ask':'› Use Archify to plan my annual leave: 10 days, plus 2 comp days that expire at the end of June.',
+ 'step1-h':'Install in one command','step1-p':'Run the command for your agent, or open the <a href="start.html?agent=cursor&amp;type=architecture">agent-aware quick start</a> for project-scoped installs.',
+ 'step2-h':'Describe your system','step2-p':'Describe the steps, people, parts, or states — or ask your agent to read a repository first.',
+ 'step3-h':'Ask your agent to draw it','step3-p':'Tell your agent to use Archify. It generates a self-contained HTML file you can open in any browser and refine in chat.',
+ 'kbd-label':'Inside every artifact','kbd-guide':'Diagram guide','kbd-theme':'Toggle theme','kbd-find':'Find node / route endpoint','kbd-route':'Trace, inspect, and play a route','kbd-radar':'Semantic radar','kbd-lens':'Compare semantic kinds','kbd-present':'Presentation stage','kbd-export':'Open export menu','kbd-focus':'Focus node','kbd-zoom':'Reading depth / reset','kbd-nav':'Navigate menu','kbd-close':'Close menu',
+ 'footer-meta':'development &nbsp;·&nbsp; v[[ARCHIFY_VERSION]] &nbsp;·&nbsp; MIT License<br>Based on Cocoon-AI/architecture-diagram-generator',
+ 'cta-h':'Describe it once.<br><em>Share the map.</em>',
+ 'cta-sub':'One command installs the checked skill for your agent — and your next diagram is a chat message away.',
+ 'cta-install':'Install the skill','cta-gh':'Star on GitHub',
+ 'footer-changelog':'Changelog','footer-license':'License','footer-community':'Community'
+ },
+ zh: {
+ 'label-life':'不只是代码',
+ 'life-h2':'不只是代码,<br><em>生活里的事也能画。</em>',
+ 'life-body':'年假规划、求职进度、租房沟通、每月收支——下面每一张都是真实生成的 Archify 成品,和系统架构图走同一套生成与校验流程。点开就能探索。',
+ 'life-note':'示例里的数字仅作演示。描述你自己的情况,Agent 就会画出你的那一张。',
+ 'life-leave-k':'工作流',
+ 'life-leave-q':'一年的假怎么排最划算?',
+ 'life-job-k':'生命周期',
+ 'life-job-q':'每份求职申请走到哪一步了?',
+ 'life-money-k':'数据流',
+ 'life-money-q':'工资每个月都去哪了?',
+ 'life-rent-k':'时序图',
+ 'life-rent-q':'租房时,谁跟谁说了什么?',
+ 'arch-k':'架构图',
+ 'wf-k':'工作流',
+ 'seq-k':'时序图',
+ 'flow-k':'数据流',
+ 'life-k':'生命周期',
+ 'nav-guide':'场景指南','nav-gallery':'验证作品集','nav-start':'快速上手','nav-community':'社区包','nav-install':'安装技能',
+ 'hero-badge':'开发版 Agent 技能 · 查看更新','hero-works':'支持',
+ 'hero-h1':'<span class="l">用大白话讲清楚,</span><span class="l">得到<em>一张可信的图。</em></span>',
+ 'hero-sub':'年假怎么排、求职走到哪步、工资去哪了,或者一整套软件系统——只要它有步骤、组成、关系或状态,你的 AI Agent 都能把它变成一张可以点开探索、交付前已经校验过的 HTML 图。',
+ 'hero-cta':'开始使用','hero-stars':'GitHub Star','copy':'复制','copied':'已复制',
+ 'demo-watch':'观看 35 秒演示','demo-title':'Archify 35 秒演示','demo-close':'关闭演示',
+ 'tour-title':'实时成品导览',
+ 'proof-live':'实时','proof-open':'打开完整成品',
+ 'beat-0-k':'全景','beat-1-k':'聚焦','beat-2-k':'上游','beat-3-k':'语义镜头',
+ 'beat-0-t':'整个系统,一屏读完。','beat-0-b':'这是真实生成的成品,不是截图。泳道、边界和每一条作者连线都在这里——继续滚动,移动它的镜头。',
+ 'beat-1-t':'聚焦一个节点,看清它驱动了什么。','beat-1-b':'在任意节点上按 Enter,或打开一个稳定链接,镜头会只保留它下游的一切。',
+ 'beat-2-t':'反转方向,找到源头。','beat-2-b':'向上游追溯,看清喂给这一步的每个依赖。同一个文件、同一组作者关系,只改一次 hash。',
+ 'beat-3-t':'按语义对比,而不是按方框。','beat-3-b':'语义镜头只保留你点名的类型——安全对数据、后端对存储——其余全部压暗。',
+ 'stat-types':'图表类型','stat-presets':'视觉预设','stat-checks':'每个成品的校验项','stat-export':'原生导出倍率','stat-deps':'运行时依赖',
+ 'label-types':'图表类型',
+ 'types-h2':'五个问题,<br><em>五种图。</em>',
+ 'types-body':'问你真正想问的问题。Archify 会选出能回答它的那种图——不管是一套软件系统、一份计划,还是你自己生活里的事。',
+ 'types-more':'浏览完整作品集','types-more-sub':'实时成品 · 全部预设 · 全部图型',
+ 'arch-h':'它由什么组成?',
+ 'arch-p':'一件事由哪些部分组成、彼此怎么连接——家里的账户和银行卡、团队分工,或者云上系统的服务、数据库与安全边界。',
+ 'arch-li1':'家庭账户','arch-li2':'团队分工','arch-li3':'微服务拓扑','arch-li4':'云与安全边界',
+ 'wf-h':'下一步做什么?',
+ 'wf-p':'跨人、跨阶段的步骤——办签证、排年假、新人入职、审批链,或者 CI/CD 流水线,逐泳道铺开。',
+ 'seq-h':'谁先谁后,怎么来回?',
+ 'seq-p':'按顺序的一来一回——通过中介租房、报销往返,或者带返回值的 API 调用链。',
+ 'flow-h':'东西都流向哪里?',
+ 'flow-p':'东西从哪来、最后落到哪——工资流向账单和储蓄、文件流转审阅,或者数据穿过管道。',
+ 'life-h':'现在走到哪一步了?',
+ 'life-p':'有哪些状态、怎么在状态之间变化——求职申请、一笔订单、护照换发或一次部署,含等待、重试和结局。',
+ 'label-features':'输出',
+ 'features-h2':'一个文件,<br><em>全部都在里面。</em>',
+ 'cmp-light':'浅色','cmp-dark':'深色',
+ 'fv1-h':'双主题输出','fv1-p':'每张图都内置协调的深色与浅色变量集:HTML 的主题开关与 SVG 的 @media prefers-color-scheme 规则同步切换——一个文件,自动跟随读者主题。','fv1-tag':'浅色 · 深色 · 单文件',
+ 'fv2-h':'一个菜单,全部格式','fv2-p':'PNG、JPEG、WebP、双主题 SVG、WebM 动图,或直接复制到剪贴板——所有导出都在浏览器内原生渲染,同一个菜单完成。',
+ 'exp-clip-fmt':'剪贴板',
+ 'f2-h':'超清 4× 导出','f2-p':'PNG、JPEG、WebP——由浏览器以最高 4 倍分辨率原生栅格化,无上采样模糊。视网膜屏、幻灯片、印刷均清晰。',
+ 'f5-h':'独立 HTML 文件','f5-p':'单个 HTML 文件,零依赖、无需服务器或构建工具,任意浏览器打开即用。作为附件发邮件或贴 PR 评论均可。',
+ 'f6-h':'对话式迭代','f6-p':'「把暑假旅行挪到八月」「加一个 Redis」「把截止日标红」——用大白话精调,不用学任何画图工具。',
+ 'f7-h':'检查并播放真实路径','f7-p':'Route Journey 始终保留完整作者路径,可逐站检查,也可沿每条精确入向关系播放一次由读者控制的有限旅程。','f7-tag':'检查 · 播放 · 暂停',
+ 'label-palette':'设计系统',
+ 'palette-h2':'每种颜色,<br><em>都有含义。</em>',
+ 'palette-body':'七种节点颜色,深浅主题下保持一致。图例可以按你的故事改名——「后端」可以叫「假期」,「安全」可以叫「规则」。',
+ 'chip-frontend':'前端','chip-frontend-use':'客户端、浏览器、移动端、UI',
+ 'chip-backend':'后端','chip-backend-use':'服务、API、Worker、守护进程',
+ 'chip-database':'数据库','chip-database-use':'数据库、缓存、存储、AI/ML',
+ 'chip-cloud':'云服务','chip-cloud-use':'托管服务、基础设施',
+ 'chip-security':'安全','chip-security-use':'鉴权、密钥、安全网关',
+ 'chip-bus':'消息总线','chip-bus-use':'Kafka、RabbitMQ、SNS',
+ 'chip-external':'外部系统','chip-external-use':'用户、第三方、通用外部',
+ 'label-qs':'快速开始',
+ 'qs-h2':'三步上手,<br><em>一条命令。</em>',
+ 'qs-body':'同一份经过检查的 Skill 可用于 Claude Code、Codex、Cursor、OpenCode 和 GitHub Copilot。选择你的 Agent,获取准确命令。',
+ 'term-c1':'# 为你的 Agent 全局安装','term-c2':'# 或者用临时副本在 Codex 中试一次','term-c3':'# 然后直接说',
+ 'term-ask':'› 用 Archify 帮我排一下今年的年假:10 天年假,加 2 天 6 月底过期的调休。',
+ 'step1-h':'一条命令安装','step1-p':'运行对应 Agent 的命令,或打开<a href="start.html?agent=cursor&amp;type=architecture">可切换 Agent 的快速开始页</a>获取项目级安装命令。',
+ 'step2-h':'描述你的系统','step2-p':'描述步骤、角色、组成或状态,也可以先让 agent 读一下代码仓库。',
+ 'step3-h':'让 agent 绘制','step3-p':'告诉 agent 使用 Archify,它会生成可在任意浏览器打开的单文件 HTML,并可继续在对话中迭代。',
+ 'kbd-label':'每个成品都内置','kbd-guide':'图表指南','kbd-theme':'切换主题','kbd-find':'查找节点 / 路径端点','kbd-route':'探查、检查并播放路径','kbd-radar':'语义雷达','kbd-lens':'对比语义类型','kbd-present':'演示舞台','kbd-export':'打开导出菜单','kbd-focus':'聚焦节点','kbd-zoom':'阅读层级 / 复位','kbd-nav':'菜单导航','kbd-close':'关闭菜单',
+ 'footer-meta':'开发版 &nbsp;·&nbsp; v[[ARCHIFY_VERSION]] &nbsp;·&nbsp; MIT 许可证<br>基于 Cocoon-AI/architecture-diagram-generator',
+ 'cta-h':'描述一次,<br><em>分享这张图。</em>',
+ 'cta-sub':'一条命令为你的 Agent 安装经过检查的技能——下一张架构图,只差一句对话。',
+ 'cta-install':'安装技能','cta-gh':'在 GitHub 上 Star',
+ 'footer-changelog':'更新日志','footer-license':'许可证','footer-community':'社区包'
+ }
+ };
+
+export const guideCopy = {
+ en: {
+ navGuide:'Guide',navProof:'Proof Lab',navStart:'Start',navCommunity:'Community',navInstall:'Install Skill',versionLabel:'Scenario guide / development / v[[ARCHIFY_VERSION]]',eyebrow:'Question-first diagramming', headline:'Choose the question.<br>Get the <em>right diagram.</em>', lede:'Describe what your audience needs to understand. Archify recommends one bounded visual recipe—plus the evidence it must contain, when not to use it, and a prompt you can copy.',
+ metricRecipes:'real-world<br>recipes',metricModes:'typed diagram<br>modes',metricRuntime:'runtime<br>dependencies',chooserTitle:'What must the diagram explain?',chooserBody:'Write a situation, not a diagram type. Specific system facts produce a stronger recommendation.',placeholder:'Example: Show an API request with JWT auth, a Redis cache miss, database fallback, and async tracing.',recommend:'Recommend a recipe →',clear:'Clear',libraryEyebrow:'Recipe library',libraryTitle:'13 small, opinionated starting points.',libraryBody:'Each recipe answers one technical question. That boundary keeps the result legible, reviewable, and honest about missing evidence.',footerLeft:'Generated from the same recipe source as the Archify CLI.',all:'All recipes',recommended:'Recommended recipe',use:'Use when',avoid:'Avoid when',must:'Evidence to include',presentation:'Presentation',prompt:'Copy-ready prompt',copyPrompt:'Copy prompt',copied:'Copied',alternatives:'Other possible fits:',confidence:'confidence',open:'Open recipe',proofReady:'Verified proof',proofLink:'Open verified example ↗',
+ samples:[['API + cache miss','Show an API request with JWT auth, a Redis cache miss, database fallback, and async tracing.'],['Kafka + DLQ','Map Kafka topics, ordered processors, consumer groups, replay, state stores, and the dead-letter queue.'],['Incident response','Show how responders detect, triage, mitigate, escalate, communicate, and verify recovery.']]
+ },
+ zh: {
+ navGuide:'场景指南',navProof:'验证作品集',navStart:'快速上手',navCommunity:'社区包',navInstall:'安装技能',versionLabel:'场景指南 / 开发版 / v[[ARCHIFY_VERSION]]',eyebrow:'先问题,后图表',headline:'先选对问题,<br>再得到<em>对的图。</em>',lede:'描述受众真正需要理解的内容。Archify 会推荐一个有边界的视觉配方,同时给出证据清单、禁用条件和可复制提示词。',
+ metricRecipes:'个真实场景<br>配方',metricModes:'种类型化<br>图表模式',metricRuntime:'个运行时<br>依赖',chooserTitle:'这张图必须解释什么?',chooserBody:'写清场景,不要只写图表类型。系统事实越具体,推荐越可靠。',placeholder:'例如:展示带 JWT 鉴权、Redis 缓存未命中、数据库回退和异步追踪的 API 请求。',recommend:'推荐配方 →',clear:'清空',libraryEyebrow:'配方库',libraryTitle:'13 个小而专的起点。',libraryBody:'每个配方只回答一个技术问题。清晰的边界让图更易读、可评审,也不会掩盖证据缺口。',footerLeft:'网页与 Archify CLI 使用同一份配方数据生成。',all:'全部配方',recommended:'推荐配方',use:'适合',avoid:'不要这样用',must:'必须包含的证据',presentation:'表现建议',prompt:'可直接复制的提示词',copyPrompt:'复制提示词',copied:'已复制',alternatives:'其他可能:',confidence:'置信度',open:'打开配方',proofReady:'已验证成品',proofLink:'打开验证成品 ↗',
+ samples:[['API + 缓存未命中','展示带 JWT 鉴权、Redis 缓存未命中、数据库回退和异步追踪的 API 请求。'],['Kafka + 死信','梳理 Kafka Topic、有序处理器、消费者组、重放、状态存储和死信队列。'],['事故处置','展示响应者如何发现、分诊、缓解、升级、沟通并验证恢复。']]
+ }
+ };
+
+// The same copy follows the checkout's recipe inventory on development and stable.
+export function guideCopyFor(recipes, channel = 'development') {
+ return Object.fromEntries(Object.entries(guideCopy).map(([lang, values]) => [lang, {
+ ...values,
+ versionLabel: lang === 'zh' ? `场景指南 / ${channel === 'development' ? '开发版' : '稳定版'} / v[[ARCHIFY_VERSION]]` : `Scenario guide / ${channel} / v[[ARCHIFY_VERSION]]`,
+ libraryTitle: lang === 'zh' ? `${recipes.length} 个小而专的起点。` : `${recipes.length} small, opinionated starting points.`,
+ }]));
+}
+
+export function indexCopyFor(channel) {
+ if (channel === 'development') return indexCopy;
+ return {
+ en: { ...indexCopy.en, 'hero-badge': "Stable Agent Skill · see what's new", 'footer-meta': indexCopy.en['footer-meta'].replace('development', 'stable') },
+ zh: { ...indexCopy.zh, 'hero-badge': '稳定版 Agent 技能 · 查看更新', 'footer-meta': indexCopy.zh['footer-meta'].replace('开发版', '稳定版') },
+ };
+}
diff --git a/website/src/data/site-urls.mjs b/website/src/data/site-urls.mjs
new file mode 100644
index 00000000..e77019cd
--- /dev/null
+++ b/website/src/data/site-urls.mjs
@@ -0,0 +1,13 @@
+export const canonicalOrigin = 'https://archify.si';
+export const sitePages = ['index', 'guide', 'start', 'gallery', 'community'];
+export function canonicalPath(page, lang = 'en') {
+ return page === 'index' ? (lang === 'zh' ? '/zh' : '/') : `${lang === 'zh' ? '/zh/' : '/'}${page}`;
+}
+export function canonicalUrl(page, lang = 'en') {
+ return new URL(canonicalPath(page, lang), canonicalOrigin).href;
+}
+// Paths are relative to the site's root <base>, so exported files also work on file://.
+export function localPagePath(page, lang = 'en', cloudflare = false) {
+ if (page === 'index') return lang === 'zh' ? 'zh' + (cloudflare ? '' : '.html') : './';
+ return `${lang === 'zh' ? 'zh/' : ''}${page}${cloudflare ? '' : '.html'}`;
+}
diff --git a/website/src/data/start-head.html b/website/src/data/start-head.html
index 5b6965a2..8e052456 100644
--- a/website/src/data/start-head.html
+++ b/website/src/data/start-head.html
@@ -10,6 +10,4 @@
<meta property="og:url" content="https://tt-a1i.github.io/archify/start.html">
<meta property="og:image" content="https://tt-a1i.github.io/archify/assets/archify-social-preview.png">
<link rel="icon" type="image/svg+xml" href="assets/archify-mark.svg">
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,400&family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;450;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <link href="fonts/fonts.css" rel="stylesheet">
diff --git a/website/src/layouts/SiteLayout.astro b/website/src/layouts/SiteLayout.astro
index 764d9b46..baf17ca6 100644
--- a/website/src/layouts/SiteLayout.astro
+++ b/website/src/layouts/SiteLayout.astro
@@ -1,22 +1,56 @@
---
import '../styles/utilities.css';
import siteCss from '../styles/site.css?raw';
-interface Props { head: string; css: string }
-const { head, css } = Astro.props;
+import languageScript from '../scripts/site-language.js?raw';
+import { version, versioned, jsonScript, guide } from '../data/site';
+import { indexCopyFor, guideCopyFor } from '../data/site-translations.mjs';
+import { defaultProofLabels } from '../data/default-proof-labels.mjs';
+import { productChannel } from '../data/product-facts';
+import { canonicalUrl } from '../data/site-urls.mjs';
+import { pageMetadata } from '../data/site-metadata.mjs';
+import { localizeHtml } from '../data/localize-html.mjs';
+interface Props { head: string; css: string; page: 'index' | 'guide' | 'start' | 'gallery' | 'community'; lang?: 'en' | 'zh' }
+const { head, css, page, lang = 'en' } = Astro.props;
const cloudflare = Astro.site?.origin === 'https://archify.si';
-const pagePath = Astro.url.pathname.replace(/\/index\.html$/, '/').replace(/\.html$/, '').replace(/\/$/, '') || '/';
-const canonical = cloudflare ? new URL(pagePath, Astro.site).href : undefined;
-const pageHead = cloudflare
- ? head.replaceAll('https://tt-a1i.github.io/archify/', 'https://archify.si/').replace(/(<meta property="og:url" content=")[^"]*(")/, `$1${canonical}$2`)
- : head;
+const metadata = pageMetadata(page, lang, version);
+const copy = page === 'index' ? indexCopyFor(productChannel) : page === 'guide' ? guideCopyFor(guide, productChannel) : {};
+const body = localizeHtml(versioned(await Astro.slots.render('default')), { lang, page, cloudflare, copy: JSON.parse(versioned(JSON.stringify(copy))) });
+// Font loading and the favicon remain page resources; metadata has one source.
+const resourceHead = head.replace(/<meta\b[^>]*>/gi, '').replace(/<title>[\s\S]*?<\/title>/gi, '').replace(/<link\b[^>]*rel=["'](?:canonical|alternate)["'][^>]*>/gi, '');
---
<!DOCTYPE html>
-<html lang="en">
+<html lang={lang === 'zh' ? 'zh-Hans' : 'en'}>
<head>
- <Fragment set:html={pageHead} />
- {canonical && <link rel="canonical" href={canonical} />}
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <base href={lang === 'zh' && page !== 'index' ? '../' : './'} />
+ <title>{metadata.title}</title>
+ <meta name="description" content={metadata.description} />
+ <meta name="theme-color" content="#07080a" />
+ <link rel="canonical" href={metadata.canonical} />
+ <link rel="alternate" hreflang="en" href={canonicalUrl(page, 'en')} />
+ <link rel="alternate" hreflang="zh-Hans" href={canonicalUrl(page, 'zh')} />
+ <link rel="alternate" hreflang="x-default" href={canonicalUrl(page, 'en')} />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="Archify" />
+ <meta property="og:title" content={metadata.title} />
+ <meta property="og:description" content={metadata.description} />
+ <meta property="og:url" content={metadata.canonical} />
+ <meta property="og:image" content={metadata.image} />
+ <meta property="og:locale" content={lang === 'zh' ? 'zh_CN' : 'en_US'} />
+ <meta property="og:locale:alternate" content={lang === 'zh' ? 'en_US' : 'zh_CN'} />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content={metadata.title} />
+ <meta name="twitter:description" content={metadata.description} />
+ <meta name="twitter:image" content={metadata.image} />
+ <script is:inline type="application/ld+json" set:html={jsonScript(metadata.schema)}></script>
+ <Fragment set:html={resourceHead} />
+ <script is:inline id="site-route" type="application/json" set:html={jsonScript({ page, lang, cloudflare })}></script>
+ <script is:inline id="site-copy" type="application/json" set:html={versioned(jsonScript(copy))}></script>
+ {page === 'index' && <script is:inline id="site-proof-labels" type="application/json" set:html={jsonScript(defaultProofLabels)}></script>}
+ <script is:inline set:html={languageScript}></script>
<script is:inline>(function () { var t = 'light'; try { t = localStorage.getItem('archify-site-theme') || 'light'; } catch (_) {} document.documentElement.setAttribute('data-theme', t === 'dark' ? 'dark' : 'light'); })();</script>
<style is:inline set:html={siteCss + css}></style>
</head>
-<body><slot /></body>
+<body><Fragment set:html={body} /></body>
</html>
diff --git a/website/src/pages/community.astro b/website/src/pages/community.astro
index d52b8e9c..ccc7c6f1 100644
--- a/website/src/pages/community.astro
+++ b/website/src/pages/community.astro
@@ -1,5 +1,6 @@
---
import { version, versioned } from '../data/site';
+import { productChannel } from '../data/product-facts';
import { packages, typeOrder, typeCounts, type PackageType } from '../data/community';
import SiteLayout from '../layouts/SiteLayout.astro';
import Navigation from '../components/Navigation.astro';
@@ -15,8 +16,9 @@ const typeLabels: Record<PackageType, { en: string; zh: string }> = {
wrapper: { en: 'Wrapper', zh: '命令行封装' },
};
const activeTypes = typeOrder.filter((type) => typeCounts[type] > 0);
+const { lang = 'en' } = Astro.props;
---
-<SiteLayout head={versioned(head)} css={css}>
+<SiteLayout page="community" lang={lang} head={versioned(head)} css={css}>
<div class="grid-bg" aria-hidden="true"></div>
@@ -132,7 +134,7 @@ const activeTypes = typeOrder.filter((type) => typeCounts[type] > 0);
<footer>
<div class="shell footer-inner">
<span data-en="Community packages are maintained by their authors. Listing is not endorsement; Archify never executes package code." data-zh="社区包由各自作者维护。收录不代表官方背书;Archify 绝不执行第三方包的代码。">Community packages are maintained by their authors. Listing is not endorsement; Archify never executes package code.</span>
- <span data-en={`Archify v${version} · stable · MIT`} data-zh={`Archify v${version} · 稳定版 · MIT`}>Archify v{version} · stable · MIT</span>
+ <span data-en={`Archify v${version} · ${productChannel} · MIT`} data-zh={`Archify v${version} · ${productChannel === 'stable' ? '稳定版' : '开发版'} · MIT`}>Archify v{version} · {productChannel} · MIT</span>
</div>
</footer>
diff --git a/website/src/pages/gallery.astro b/website/src/pages/gallery.astro
index e575f249..697e2520 100644
--- a/website/src/pages/gallery.astro
+++ b/website/src/pages/gallery.astro
@@ -6,8 +6,9 @@ import Navigation from '../components/Navigation.astro';
import head from '../data/gallery-head.html?raw';
import css from '../styles/gallery.css?raw';
import pageScript from '../scripts/gallery.js?raw';
+const { lang = 'en' } = Astro.props;
---
-<SiteLayout head={versioned(head)} css={css}>
+<SiteLayout page="gallery" lang={lang} head={versioned(head)} css={css}>
<div class="grid-bg" aria-hidden="true"></div>
@@ -32,7 +33,7 @@ import pageScript from '../scripts/gallery.js?raw';
<section class="controls" aria-label="Gallery controls">
<div class="shell controls-inner">
<div class="filter-group" role="group" aria-label="Filter diagrams by type">
- <button class="filter-button" type="button" data-filter="all" aria-pressed="true" data-en="All / 11" data-zh="全部配方 / 11">All / 11</button>
+ <button class="filter-button" type="button" data-filter="all" aria-pressed="true" data-en={`All / ${cards.length}`} data-zh={`全部配方 / ${cards.length}`}>All / {cards.length}</button>
<button class="filter-button" type="button" data-filter="architecture" aria-pressed="false" data-en="Architecture" data-zh="架构图">Architecture</button>
<button class="filter-button" type="button" data-filter="workflow" aria-pressed="false" data-en="Workflow" data-zh="工作流">Workflow</button>
<button class="filter-button" type="button" data-filter="sequence" aria-pressed="false" data-en="Sequence" data-zh="时序图">Sequence</button>
diff --git a/website/src/pages/guide.astro b/website/src/pages/guide.astro
index 054500b3..612c6970 100644
--- a/website/src/pages/guide.astro
+++ b/website/src/pages/guide.astro
@@ -2,11 +2,13 @@
import { version, versioned, jsonScript, guide } from '../data/site';
import SiteLayout from '../layouts/SiteLayout.astro';
import Navigation from '../components/Navigation.astro';
+import RecipeReference from '../components/RecipeReference.astro';
import head from '../data/guide-head.html?raw';
import css from '../styles/guide.css?raw';
import pageScript from '../scripts/guide.js?raw';
+const { lang = 'en' } = Astro.props;
---
-<SiteLayout head={versioned(head)} css={css}>
+<SiteLayout page="guide" lang={lang} head={versioned(head)} css={css}>
<div class="grid-bg" aria-hidden="true"></div>
@@ -20,8 +22,8 @@ import pageScript from '../scripts/guide.js?raw';
<p class="lede" data-i18n="lede">Describe what your audience needs to understand. Archify recommends one bounded visual recipe—plus the evidence it must contain, when not to use it, and a prompt you can copy.</p>
</div>
<div class="metrics" aria-label="Guide metrics">
- <div class="metric"><strong>12</strong><span data-i18n-html="metricRecipes">real-world<br>recipes</span></div>
- <div class="metric"><strong>5</strong><span data-i18n-html="metricModes">typed diagram<br>modes</span></div>
+ <div class="metric"><strong>{guide.length}</strong><span data-i18n-html="metricRecipes">real-world<br>recipes</span></div>
+ <div class="metric"><strong>{new Set(guide.map(recipe => recipe.type)).size}</strong><span data-i18n-html="metricModes">typed diagram<br>modes</span></div>
<div class="metric"><strong>0</strong><span data-i18n-html="metricRuntime">runtime<br>dependencies</span></div>
</div>
</section>
@@ -42,12 +44,13 @@ import pageScript from '../scripts/guide.js?raw';
<section class="library" id="library">
<div class="section-head">
- <div><div class="lead-label" data-i18n="libraryEyebrow">Recipe library</div><h2 data-i18n="libraryTitle">12 small, opinionated starting points.</h2></div>
+ <div><div class="lead-label" data-i18n="libraryEyebrow">Recipe library</div><h2 data-i18n="libraryTitle">{guide.length} small, opinionated starting points.</h2></div>
<p data-i18n="libraryBody">Each recipe answers one technical question. That boundary keeps the result legible, reviewable, and honest about missing evidence.</p>
</div>
<div class="filters" id="filters" aria-label="Filter recipes"></div>
<div class="cards" id="cards"></div>
</section>
+ <RecipeReference recipes={guide} />
</main>
<footer><div class="shell"><span data-i18n="footerLeft">Generated from the same recipe source as the Archify CLI.</span><span>archify guide "your scenario"</span><span data-i18n="versionLabel">Scenario guide / stable / v{version}</span></div></footer>
diff --git a/website/src/pages/index.astro b/website/src/pages/index.astro
index 91a381a9..c4a20108 100644
--- a/website/src/pages/index.astro
+++ b/website/src/pages/index.astro
@@ -3,16 +3,20 @@ import { version, versioned } from '../data/site';
import SiteLayout from '../layouts/SiteLayout.astro';
import Navigation from '../components/Navigation.astro';
import Brand from '../components/Brand';
+import ProductFacts from '../components/ProductFacts.astro';
+import { defaultProofLabels } from '../data/default-proof-labels.mjs';
import head from '../data/index-head.html?raw';
import css from '../styles/index.css?raw';
import pageScript from '../scripts/index.js?raw';
const installCommand = 'npx -y skills add tt-a1i/archify --skill archify --agent claude-code --global --copy --yes';
+const { lang = 'en' } = Astro.props;
---
-<SiteLayout head={versioned(head)} css={css}>
+<SiteLayout page="index" lang={lang} head={versioned(head)} css={css}>
<!-- NAV -->
<Navigation page="index" />
+ <main id="main-content">
<!-- HERO — centered statement; the live artifact window peeks in below the fold line -->
<section class="hero" data-proof-aperture="first-fold">
@@ -79,7 +83,7 @@ const installCommand = 'npx -y skills add tt-a1i/archify --skill archify --agent
<svg width="11" height="11" viewBox="0 0 12 12" fill="none"><rect x="2" y="5.5" width="8" height="5.5" rx="1.2" stroke="currentColor" stroke-width="1.2"/><path d="M4 5.5V4a2 2 0 1 1 4 0v1.5" stroke="currentColor" stroke-width="1.2"/></svg>
<span id="address-file">agent-tool-call.workflow.html</span><b id="address-hash"></b>
</div>
- <a class="proof-open" id="proof-open" href="gallery/artifacts/agent-tool-call.workflow.html?present=1#focus=planner&amp;reach=downstream" target="_blank" rel="noopener">
+ <a class="proof-open" id="proof-open" href="gallery/artifacts/agent-tool-call.workflow.html?present=1#focus=planner&amp;reach=downstream" target="_blank" rel="noopener" aria-label={lang === 'zh' ? '在新标签页打开交互图表' : 'Open the interactive diagram in a new tab'}>
<span data-i18n="proof-open">Open artifact</span><span aria-hidden="true">↗</span>
</a>
</div>
@@ -93,10 +97,10 @@ const installCommand = 'npx -y skills add tt-a1i/archify --skill archify --agent
<button class="beat-tick" type="button" data-beat="2" aria-pressed="false"><span data-i18n="beat-2-k">Upstream</span></button>
<button class="beat-tick" type="button" data-beat="3" aria-pressed="false"><span data-i18n="beat-3-k">Lens</span></button>
</div>
- <p class="beat-meta"><span class="proof-live" data-i18n="proof-live">Live proof</span><span id="proof-meta">Workflow · Signal Flow · 12 nodes · 11 edges</span></p>
- <h3 class="beat-title" id="beat-title">The whole system, in one readable frame.</h3>
- <p class="beat-body" id="beat-body">This is the real generated artifact, not a screenshot. Lanes, boundaries, and every authored edge — scroll to move its camera.</p>
- <strong class="sr-only" id="proof-title">Agent Tool Call — policy, execution, recovery, and evidence</strong>
+ <p class="beat-meta"><span class="proof-live" data-i18n="proof-live">Live proof</span><span id="proof-meta" data-en={defaultProofLabels.meta.en} data-zh={defaultProofLabels.meta.zh}>{defaultProofLabels.meta.en}</span></p>
+ <h3 class="beat-title" id="beat-title" data-i18n="beat-0-t">The whole system, in one readable frame.</h3>
+ <p class="beat-body" id="beat-body" data-i18n="beat-0-b">This is the real generated artifact, not a screenshot. Lanes, boundaries, and every authored edge — scroll to move its camera.</p>
+ <strong class="sr-only" id="proof-title" data-en={defaultProofLabels.title.en} data-zh={defaultProofLabels.title.zh}>{defaultProofLabels.title.en}</strong>
</div>
</div>
</div>
@@ -335,17 +339,17 @@ const installCommand = 'npx -y skills add tt-a1i/archify --skill archify --agent
<ol class="steps fade-up d1">
<li class="step">
<span class="step-num">1</span>
- <div><h4 data-i18n="step1-h">Install in one command</h4>
+ <div><h3 data-i18n="step1-h">Install in one command</h3>
<p data-i18n="step1-p">Run the command for your agent, or open the <a href="start.html?agent=cursor&amp;type=architecture">agent-aware quick start</a> for project-scoped installs.</p></div>
</li>
<li class="step">
<span class="step-num">2</span>
- <div><h4 data-i18n="step2-h">Describe your system</h4>
+ <div><h3 data-i18n="step2-h">Describe your system</h3>
<p data-i18n="step2-p">Describe the steps, people, parts, or states — or ask your agent to read a repository first.</p></div>
</li>
<li class="step">
<span class="step-num">3</span>
- <div><h4 data-i18n="step3-h">Ask your agent to draw it</h4>
+ <div><h3 data-i18n="step3-h">Ask your agent to draw it</h3>
<p data-i18n="step3-p">Tell your agent to use Archify. It generates a self-contained HTML file you can open in any browser and refine in chat.</p></div>
</li>
</ol>
@@ -371,6 +375,8 @@ const installCommand = 'npx -y skills add tt-a1i/archify --skill archify --agent
</div>
</section>
+ <ProductFacts />
+
<!-- CLOSING CTA -->
<section id="cta">
<div class="cta-glow" aria-hidden="true"></div>
@@ -385,6 +391,7 @@ const installCommand = 'npx -y skills add tt-a1i/archify --skill archify --agent
</section>
<!-- FOOTER -->
+ </main>
<footer>
<div class="footer-inner">
<div class="footer-left">
diff --git a/website/src/pages/start.astro b/website/src/pages/start.astro
index 21361fbf..cf480dfc 100644
--- a/website/src/pages/start.astro
+++ b/website/src/pages/start.astro
@@ -5,8 +5,9 @@ import Navigation from '../components/Navigation.astro';
import head from '../data/start-head.html?raw';
import css from '../styles/start.css?raw';
import pageScript from '../scripts/start.js?raw';
+const { lang = 'en' } = Astro.props;
---
-<SiteLayout head={versioned(head)} css={css}>
+<SiteLayout page="start" lang={lang} head={versioned(head)} css={css}>
<div class="grid-bg" aria-hidden="true"></div>
@@ -30,7 +31,7 @@ import pageScript from '../scripts/start.js?raw';
<button class="input-path" type="button" role="tab" data-input="description"><strong data-en="Just describe it" data-zh="直接描述">直接描述</strong><span data-en="Start in any chat. No files or repository needed." data-zh="在任意对话里开始,不需要文件或代码库。">Start in any chat. No files or repository needed.</span></button>
<button class="input-path" type="button" role="tab" data-input="repository"><strong data-en="Use a repository" data-zh="从代码库开始">Use a repository</strong><span data-en="Let the agent inspect code when source evidence matters." data-zh="需要源码证据时,再让 Agent 检查代码。">Let the agent inspect code when source evidence matters.</span></button>
</div>
- <p class="type-label" id="type-label"><span data-en="Choose the question shape" data-zh="选择问题形态">Choose the question shape</span><strong data-en="5 typed renderers" data-zh="5 种类型化渲染器">5 typed renderers</strong></p>
+ <p class="type-label" id="type-label"><span data-en="Choose the question shape" data-zh="选择问题形态">Choose the question shape</span><strong data-en={`${Object.keys(starts).length} typed renderers`} data-zh={`${Object.keys(starts).length} 种类型化渲染器`}>{Object.keys(starts).length} typed renderers</strong></p>
<div class="type-tabs" role="tablist" aria-label="Diagram type">
<button class="type-tab" type="button" role="tab" data-type="architecture" data-en="Architecture" data-zh="架构图">Architecture</button>
<button class="type-tab" type="button" role="tab" data-type="workflow" data-en="Workflow" data-zh="工作流">Workflow</button>
@@ -70,17 +71,17 @@ import pageScript from '../scripts/start.js?raw';
<article class="panel" aria-live="polite">
<div class="panel-kicker"><b>02</b><span data-en="Ask one bounded question" data-zh="只问一个有边界的问题">Ask one bounded question</span></div>
- <h2 id="recipe-title">System overview</h2>
- <p class="question" id="recipe-question"></p>
- <ul class="include-list" id="include-list" aria-label="Required evidence"></ul>
- <p class="prompt-box" id="recipe-prompt"></p>
+ <h2 id="recipe-title" data-en={starts.architecture.en.title} data-zh={starts.architecture.zh.title}>{starts.architecture.en.title}</h2>
+ <p class="question" id="recipe-question" data-en={starts.architecture.en.question} data-zh={starts.architecture.zh.question}>{starts.architecture.en.question}</p>
+ <ul class="include-list" id="include-list" aria-label="Required evidence">{starts.architecture.en.include.map((item, index) => <li data-en={item} data-zh={starts.architecture.zh.include[index]}>{item}</li>)}</ul>
+ <p class="prompt-box" id="recipe-prompt" data-en={starts.architecture.en.descriptionPrompt} data-zh={starts.architecture.zh.descriptionPrompt}>{starts.architecture.en.descriptionPrompt}</p>
<div class="actions">
<button class="action action-primary" id="copy-starter" type="button" data-en="Copy install + prompt" data-zh="复制安装命令 + 提示词">Copy install + prompt</button>
<button class="action" id="copy-prompt" type="button" data-en="Prompt only" data-zh="仅复制提示词">Prompt only</button>
- <a class="action" id="proof-link" href="gallery.html" data-en="Open verified proof ↗" data-zh="打开验证成品 ↗">Open verified proof ↗</a>
+ <a class="action" id="proof-link" href={`gallery.html#proof-${starts.architecture.proof}`} data-en="Open verified proof ↗" data-zh="打开验证成品 ↗">Open verified proof ↗</a>
<a class="action" href="guide.html" data-en="Need another recipe?" data-zh="需要其他配方?">Need another recipe?</a>
</div>
- <p class="proof-meta" id="proof-meta"></p>
+ <p class="proof-meta" id="proof-meta">{starts.architecture.type} · {starts.architecture.presentation.preset} · {starts.architecture.presentation.motion}</p>
</article>
</section>
diff --git a/website/src/pages/zh/community.astro b/website/src/pages/zh/community.astro
new file mode 100644
index 00000000..5e507aa6
--- /dev/null
+++ b/website/src/pages/zh/community.astro
@@ -0,0 +1,4 @@
+---
+import Page from "../community.astro";
+---
+<Page lang="zh" />
diff --git a/website/src/pages/zh/gallery.astro b/website/src/pages/zh/gallery.astro
new file mode 100644
index 00000000..9e4fc87b
--- /dev/null
+++ b/website/src/pages/zh/gallery.astro
@@ -0,0 +1,4 @@
+---
+import Page from "../gallery.astro";
+---
+<Page lang="zh" />
diff --git a/website/src/pages/zh/guide.astro b/website/src/pages/zh/guide.astro
new file mode 100644
index 00000000..47c71688
--- /dev/null
+++ b/website/src/pages/zh/guide.astro
@@ -0,0 +1,4 @@
+---
+import Page from "../guide.astro";
+---
+<Page lang="zh" />
diff --git a/website/src/pages/zh/index.astro b/website/src/pages/zh/index.astro
new file mode 100644
index 00000000..544d0fc4
--- /dev/null
+++ b/website/src/pages/zh/index.astro
@@ -0,0 +1,4 @@
+---
+import Page from "../index.astro";
+---
+<Page lang="zh" />
diff --git a/website/src/pages/zh/start.astro b/website/src/pages/zh/start.astro
new file mode 100644
index 00000000..45d5c3fb
--- /dev/null
+++ b/website/src/pages/zh/start.astro
@@ -0,0 +1,4 @@
+---
+import Page from "../start.astro";
+---
+<Page lang="zh" />
diff --git a/website/src/scripts/community.js b/website/src/scripts/community.js
index b6b82db5..5e92f53c 100644
--- a/website/src/scripts/community.js
+++ b/website/src/scripts/community.js
@@ -7,7 +7,7 @@
function applyLanguage(next) {
language = ArchifySiteLanguage.write(next);
- document.documentElement.lang = language === 'zh' ? 'zh-CN' : 'en';
+ document.documentElement.lang = language === 'zh' ? 'zh-Hans' : 'en';
document.querySelectorAll('[data-en][data-zh]').forEach(function (node) {
var text = node.getAttribute(language === 'zh' ? 'data-zh' : 'data-en');
// Only fixed page copy opts into markup. Registry strings are text.
@@ -41,7 +41,6 @@
filterButtons.forEach(function (button) {
button.addEventListener('click', function () { applyFilter(button.getAttribute('data-filter'), true); });
});
- document.getElementById('language').addEventListener('click', function () { applyLanguage(language === 'en' ? 'zh' : 'en'); });
var allowed = ['all'].concat(Array.prototype.slice.call(document.querySelectorAll('[data-filter]')).map(function (button) {
return button.getAttribute('data-filter');
diff --git a/website/src/scripts/gallery.js b/website/src/scripts/gallery.js
index aa1ae2d0..742dcfda 100644
--- a/website/src/scripts/gallery.js
+++ b/website/src/scripts/gallery.js
@@ -8,7 +8,7 @@
function applyLanguage(next) {
language = ArchifySiteLanguage.write(next);
- document.documentElement.lang = language === 'zh' ? 'zh-CN' : 'en';
+ document.documentElement.lang = language === 'zh' ? 'zh-Hans' : 'en';
document.querySelectorAll('[data-en][data-zh]').forEach(function (node) {
node.innerHTML = node.getAttribute(language === 'zh' ? 'data-zh' : 'data-en');
});
@@ -48,10 +48,9 @@
filterButtons.forEach(function (button) {
button.addEventListener('click', function () { applyFilter(button.getAttribute('data-filter'), true); });
});
- document.getElementById('language').addEventListener('click', function () { applyLanguage(language === 'en' ? 'zh' : 'en'); });
document.getElementById('preview-theme').addEventListener('click', function () { applyPreviewTheme(previewTheme === 'dark' ? 'light' : 'dark'); });
- var allowed = ['architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle'];
+ var allowed = filterButtons.map(function (button) { return button.getAttribute('data-filter'); });
var requested = new URLSearchParams(location.search).get('type') || 'all';
applyFilter(allowed.indexOf(requested) >= 0 ? requested : 'all', false);
applyLanguage(language);
diff --git a/website/src/scripts/guide.js b/website/src/scripts/guide.js
index 0a568688..d3ea1f09 100644
--- a/website/src/scripts/guide.js
+++ b/website/src/scripts/guide.js
@@ -2,23 +2,43 @@
(function () {
'use strict';
var recipes = JSON.parse(document.getElementById('guide-data').textContent);
- var types = ["architecture","workflow","sequence","dataflow","lifecycle"];
+ var types = Array.from(new Set(recipes.map(function (recipe) { return recipe.type; })));
var colors = { architecture:'var(--hue-cyan)', workflow:'var(--hue-emerald)', sequence:'var(--hue-violet)', dataflow:'var(--hue-amber)', lifecycle:'var(--hue-rose)' };
var language = ArchifySiteLanguage.read();
var activeType = 'all';
var lastRecipe = null;
- var copy = {
- en: {
- navGuide:'Guide',navProof:'Proof Lab',navStart:'Start',navCommunity:'Community',navInstall:'Install Skill',versionLabel:'Scenario guide / stable / v[[ARCHIFY_VERSION]]',eyebrow:'Question-first diagramming', headline:'Choose the question.<br>Get the <em>right diagram.</em>', lede:'Describe what your audience needs to understand. Archify recommends one bounded visual recipe—plus the evidence it must contain, when not to use it, and a prompt you can copy.',
- metricRecipes:'real-world<br>recipes',metricModes:'typed diagram<br>modes',metricRuntime:'runtime<br>dependencies',chooserTitle:'What must the diagram explain?',chooserBody:'Write a situation, not a diagram type. Specific system facts produce a stronger recommendation.',placeholder:'Example: Show an API request with JWT auth, a Redis cache miss, database fallback, and async tracing.',recommend:'Recommend a recipe →',clear:'Clear',libraryEyebrow:'Recipe library',libraryTitle:'12 small, opinionated starting points.',libraryBody:'Each recipe answers one technical question. That boundary keeps the result legible, reviewable, and honest about missing evidence.',footerLeft:'Generated from the same recipe source as the Archify CLI.',all:'All recipes',recommended:'Recommended recipe',use:'Use when',avoid:'Avoid when',must:'Evidence to include',presentation:'Presentation',prompt:'Copy-ready prompt',copyPrompt:'Copy prompt',copied:'Copied',alternatives:'Other possible fits:',confidence:'confidence',open:'Open recipe',proofReady:'Verified proof',proofLink:'Open verified example ↗',
- samples:[['API + cache miss','Show an API request with JWT auth, a Redis cache miss, database fallback, and async tracing.'],['Kafka + DLQ','Map Kafka topics, ordered processors, consumer groups, replay, state stores, and the dead-letter queue.'],['Incident response','Show how responders detect, triage, mitigate, escalate, communicate, and verify recovery.']]
- },
- zh: {
- navGuide:'场景指南',navProof:'验证作品集',navStart:'快速上手',navCommunity:'社区包',navInstall:'安装技能',versionLabel:'场景指南 / 稳定版 / v[[ARCHIFY_VERSION]]',eyebrow:'先问题,后图表',headline:'先选对问题,<br>再得到<em>对的图。</em>',lede:'描述受众真正需要理解的内容。Archify 会推荐一个有边界的视觉配方,同时给出证据清单、禁用条件和可复制提示词。',
- metricRecipes:'个真实场景<br>配方',metricModes:'种类型化<br>图表模式',metricRuntime:'个运行时<br>依赖',chooserTitle:'这张图必须解释什么?',chooserBody:'写清场景,不要只写图表类型。系统事实越具体,推荐越可靠。',placeholder:'例如:展示带 JWT 鉴权、Redis 缓存未命中、数据库回退和异步追踪的 API 请求。',recommend:'推荐配方 →',clear:'清空',libraryEyebrow:'配方库',libraryTitle:'12 个小而专的起点。',libraryBody:'每个配方只回答一个技术问题。清晰的边界让图更易读、可评审,也不会掩盖证据缺口。',footerLeft:'网页与 Archify CLI 使用同一份配方数据生成。',all:'全部配方',recommended:'推荐配方',use:'适合',avoid:'不要这样用',must:'必须包含的证据',presentation:'表现建议',prompt:'可直接复制的提示词',copyPrompt:'复制提示词',copied:'已复制',alternatives:'其他可能:',confidence:'置信度',open:'打开配方',proofReady:'已验证成品',proofLink:'打开验证成品 ↗',
- samples:[['API + 缓存未命中','展示带 JWT 鉴权、Redis 缓存未命中、数据库回退和异步追踪的 API 请求。'],['Kafka + 死信','梳理 Kafka Topic、有序处理器、消费者组、重放、状态存储和死信队列。'],['事故处置','展示响应者如何发现、分诊、缓解、升级、沟通并验证恢复。']]
- }
- };
+ var copy = JSON.parse(document.getElementById('site-copy').textContent);
+ var languageStateKey = 'archify-guide-language-state.v1';
+
+ // A language navigation may carry one short-lived draft within this tab.
+ // Consume before validating so a stale or unrelated visit cannot reuse it.
+ function restoreLanguageState() {
+ try {
+ var raw = sessionStorage.getItem(languageStateKey);
+ sessionStorage.removeItem(languageStateKey);
+ var state = raw ? JSON.parse(raw) : null;
+ if (!state || state.to !== window.location.href || !Number.isFinite(state.at) || Date.now() - state.at > 30000 || state.at > Date.now()) return;
+ if (typeof state.scenario === 'string' && state.scenario.length <= 65536) document.getElementById('scenario').value = state.scenario;
+ if (state.activeType === 'all' || types.indexOf(state.activeType) >= 0) activeType = state.activeType;
+ lastRecipe = recipes.find(function (recipe) { return recipe.id === state.recipe; }) || null;
+ } catch (_) {}
+ }
+ function saveLanguageState(event) {
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
+ try {
+ var scenario = document.getElementById('scenario').value;
+ if (scenario.length > 65536) return;
+ var destination = new URL(document.getElementById('language').href);
+ var current = new URL(window.location.href);
+ current.searchParams.delete('lang');
+ destination.search = current.search;
+ destination.hash = current.hash;
+ sessionStorage.setItem(languageStateKey, JSON.stringify({
+ to: destination.href, at: Date.now(), scenario: scenario,
+ activeType: activeType, recipe: lastRecipe ? lastRecipe.id : null,
+ }));
+ } catch (_) {}
+ }
function t(key) { return copy[language][key]; }
function local(recipe) { return Object.assign({}, recipe, recipe[language]); }
@@ -55,7 +75,7 @@
var recipe = local(rawRecipe);
lastRecipe = rawRecipe;
var alt = alternatives || [];
- var html = '<div class="result-main"><div><span class="result-kicker">'+escapeHtml(t('recommended'))+' · '+escapeHtml(confidence)+' '+escapeHtml(t('confidence'))+'</span><h3>'+escapeHtml(recipe.title)+'</h3><p class="result-question">'+escapeHtml(recipe.question)+'</p><p class="result-summary">'+escapeHtml(recipe.summary)+'</p>'+(recipe.proof ? '<a class="proof-link" href="gallery.html#proof-'+encodeURIComponent(recipe.proof)+'">'+escapeHtml(t('proofLink'))+'</a>' : '')+'</div><div class="boundary"><div class="boundary-item"><small>'+escapeHtml(t('use'))+'</small><p>'+escapeHtml(recipe.useWhen)+'</p></div><div class="boundary-item avoid"><small>'+escapeHtml(t('avoid'))+'</small><p>'+escapeHtml(recipe.avoidWhen)+'</p></div></div></div>';
+ var html = '<div class="result-main"><div><span class="result-kicker">'+escapeHtml(t('recommended'))+' · '+escapeHtml(confidence)+' '+escapeHtml(t('confidence'))+'</span><h3>'+escapeHtml(recipe.title)+'</h3><p class="result-question">'+escapeHtml(recipe.question)+'</p><p class="result-summary">'+escapeHtml(recipe.summary)+'</p>'+(recipe.proof ? '<a class="proof-link" href="'+ArchifySiteLanguage.page('gallery', '#proof-'+encodeURIComponent(recipe.proof))+'">'+escapeHtml(t('proofLink'))+'</a>' : '')+'</div><div class="boundary"><div class="boundary-item"><small>'+escapeHtml(t('use'))+'</small><p>'+escapeHtml(recipe.useWhen)+'</p></div><div class="boundary-item avoid"><small>'+escapeHtml(t('avoid'))+'</small><p>'+escapeHtml(recipe.avoidWhen)+'</p></div></div></div>';
html += '<div class="result-grid"><div class="checklist"><div class="mini-heading">'+escapeHtml(t('must'))+'</div><ul>'+recipe.include.map(function (item) { return '<li>'+escapeHtml(item)+'</li>'; }).join('')+'</ul><div class="presentation"><span class="tag">'+escapeHtml(recipe.type)+'</span><span class="tag">'+escapeHtml(recipe.presentation.preset)+'</span><span class="tag">'+escapeHtml(recipe.presentation.motion)+'</span></div></div>';
html += '<div class="prompt-box"><div class="prompt-bar"><div class="mini-heading" style="margin:0">'+escapeHtml(t('prompt'))+'</div><button class="copy" id="copy-prompt" type="button">'+escapeHtml(t('copyPrompt'))+'</button></div><p class="prompt-text">'+escapeHtml(recipe.prompt)+'</p></div></div>';
if (alt.length) html += '<div class="alternatives">'+escapeHtml(t('alternatives'))+alt.map(function (entry) { var item=local(entry.recipe); return '<button type="button" data-alt="'+item.id+'">'+escapeHtml(item.title)+' ['+item.type+']</button>'; }).join('')+'</div>';
@@ -71,7 +91,7 @@
}
function applyLanguage(next) {
language = ArchifySiteLanguage.write(next);
- document.documentElement.lang = language === 'zh' ? 'zh-CN' : 'en';
+ document.documentElement.lang = language === 'zh' ? 'zh-Hans' : 'en';
document.getElementById('language').textContent = language === 'zh' ? 'EN' : '中文';
document.getElementById('language').setAttribute('aria-label', language === 'zh' ? 'Switch to English' : '切换到中文');
document.querySelectorAll('[data-en][data-zh]').forEach(function (node) { node.textContent=node.getAttribute(language === 'zh' ? 'data-zh' : 'data-en'); });
@@ -91,11 +111,12 @@
}
document.getElementById('recommend').addEventListener('click',runRecommendation);
document.getElementById('clear').addEventListener('click',function () { document.getElementById('scenario').value=''; document.getElementById('result').classList.remove('visible'); lastRecipe=null; });
- document.getElementById('language').addEventListener('click',function () { applyLanguage(language === 'en' ? 'zh':'en'); });
document.getElementById('scenario').addEventListener('keydown',function (event) { if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') runRecommendation(); });
document.getElementById('samples').addEventListener('click',function (event) { var chip=event.target.closest('[data-query]'); if (!chip) return; document.getElementById('scenario').value=chip.dataset.query; runRecommendation(); });
document.getElementById('filters').addEventListener('click',function (event) { var filter=event.target.closest('[data-filter]'); if (!filter) return; activeType=filter.dataset.filter; renderFilters(); renderCards(); });
document.getElementById('cards').addEventListener('click',function (event) { var card=event.target.closest('[data-recipe]'); if (!card) return; var recipe=recipes.find(function (item) { return item.id === card.dataset.recipe; }); renderResult(recipe,'selected',[]); document.getElementById('result').scrollIntoView({behavior:'smooth',block:'center'}); });
document.getElementById('result').addEventListener('click',function (event) { if (event.target.id === 'copy-prompt') copyPrompt(); var alt=event.target.closest('[data-alt]'); if (alt) renderResult(recipes.find(function (item) { return item.id === alt.dataset.alt; }),'selected',[]); });
+ document.getElementById('language').addEventListener('click', saveLanguageState);
+ restoreLanguageState();
applyLanguage(language);
}());
diff --git a/website/src/scripts/index.js b/website/src/scripts/index.js
index 81fda61b..f8113fb0 100644
--- a/website/src/scripts/index.js
+++ b/website/src/scripts/index.js
@@ -2,172 +2,8 @@
/* ══════════════════════════════════════
i18n strings
══════════════════════════════════════ */
- const LANGS = {
- en: {
- 'label-life':'Beyond code',
- 'life-h2':'Not just for code. <em>For anything with steps.</em>',
- 'life-body':'Leave plans, job hunts, renting, a monthly budget — each one below is a real Archify artifact, generated and validated exactly like a system diagram. Open one and click around.',
- 'life-note':'Numbers in these examples are illustrative. Describe your own situation and your agent draws yours.',
- 'life-leave-k':'Workflow',
- 'life-leave-q':'How should I spread my leave across the year?',
- 'life-job-k':'Lifecycle',
- 'life-job-q':'Where does each job application stand?',
- 'life-money-k':'Data flow',
- 'life-money-q':'Where does my paycheck go each month?',
- 'life-rent-k':'Sequence',
- 'life-rent-q':'Who says what when I rent a flat?',
- 'arch-k':'Architecture',
- 'wf-k':'Workflow',
- 'seq-k':'Sequence',
- 'flow-k':'Data flow',
- 'life-k':'Lifecycle',
- 'nav-guide':'Guide','nav-gallery':'Proof Lab','nav-start':'Start','nav-community':'Community','nav-install':'Install Skill',
- 'hero-badge':"Stable Agent Skill · see what's new",'hero-works':'Works with',
- 'hero-h1':'<span class="l">Describe it in plain words.</span><span class="l">Get a map <em>you can trust.</em></span>',
- 'hero-sub':'A leave plan, a job hunt, a monthly budget, or a software system — if it has steps, parts, relationships, or states, your AI agent turns it into one explorable HTML map, validated before it ships.',
- 'hero-cta':'Get started','hero-stars':'stars on GitHub','copy':'Copy','copied':'Copied',
- 'demo-watch':'Watch the 35s demo','demo-title':'Archify 35-second demo','demo-close':'Close demo',
- 'tour-title':'Live artifact tour',
- 'proof-live':'Live','proof-open':'Open artifact',
- 'beat-0-k':'Map','beat-1-k':'Focus','beat-2-k':'Upstream','beat-3-k':'Lens',
- 'beat-0-t':'The whole system, in one readable frame.','beat-0-b':'This is the real generated artifact, not a screenshot. Lanes, boundaries, and every authored edge — scroll to move its camera.',
- 'beat-1-t':'Focus one node, see what it drives.','beat-1-b':'Press Enter on any node — or open a stable link — and the camera isolates everything downstream of it.',
- 'beat-2-t':'Flip the reach. Find the cause.','beat-2-b':'Trace upstream to every dependency that feeds a step. Same file, same authored relationships, one hash change.',
- 'beat-3-t':'Compare by meaning, not by box.','beat-3-b':'Lens keeps only the semantic kinds you name — security against data, backend against storage — and quiets the rest.',
- 'stat-types':'Diagram types','stat-presets':'Visual presets','stat-checks':'Validation checks per artifact','stat-export':'Native export scale','stat-deps':'Runtime dependencies',
- 'label-types':'Diagram types',
- 'types-h2':'Five questions. <em>Five kinds of map.</em>',
- 'types-body':'Ask the question you actually have. Archify picks the picture that answers it — for a software system, a plan, or something in your own life.',
- 'types-more':'Browse the full proof gallery','types-more-sub':'Live artifacts · every preset · every type',
- 'arch-h':'What is it made of?',
- 'arch-p':'The parts of something and how they connect — a household\'s accounts and cards, a team\'s roles, or a cloud system\'s services, databases, and security boundaries.',
- 'arch-li1':'Household accounts','arch-li2':'Team roles','arch-li3':'Microservices topology','arch-li4':'Cloud + security boundaries',
- 'wf-h':'What happens next?',
- 'wf-p':'Steps across people or stages — a visa application, a leave plan, onboarding, an approval chain, or a CI/CD pipeline, lane by lane.',
- 'seq-h':'Who says what, in what order?',
- 'seq-p':'Back-and-forth in order — renting a flat through an agent, an expense claim, or an API call chain with its returns.',
- 'flow-h':'Where does it all go?',
- 'flow-p':'Where something moves and where it lands — a paycheck into bills and savings, documents through review, or data through a pipeline.',
- 'life-h':'Where does it stand now?',
- 'life-p':'States and what moves between them — job applications, an order, a passport renewal, or a deployment — with waits, retries, and endings.',
- 'label-features':'Output',
- 'features-h2':'One file. <em>Everything inside.</em>',
- 'cmp-light':'Light','cmp-dark':'Dark',
- 'fv1-h':'Dual-theme output','fv1-p':"Every diagram ships with coordinated dark and light variable sets. The HTML theme toggle and the SVG @media prefers-color-scheme rule switch together — one file follows the reader's theme.",'fv1-tag':'LIGHT · DARK · ONE FILE',
- 'fv2-h':'One menu, every format','fv2-p':'PNG, JPEG, WebP, dual-theme SVG, WebM motion, or straight to the clipboard — every export renders natively in the browser from the same menu.',
- 'exp-clip-fmt':'Clipboard',
- 'f2-h':'Ultra-crisp 4× export','f2-p':'PNG, JPEG, WebP — all rasterized natively at up to 4× source resolution by the browser. No upsampling blur. Sharp on retina displays, slides, and print.',
- 'f5-h':'Self-contained HTML','f5-p':'One HTML file. Zero dependencies, no server, no runtime. Open it in any browser and it works. Share by attaching it to an email or PR comment.',
- 'f6-h':'Iterate by chat','f6-p':'"Move the summer trip to August", "add Redis", "make the deadline red" — refine in plain words. No diagram editor to learn.',
- 'f7-h':'Inspect and play real routes','f7-p':'Route Journey keeps the complete authored path visible while you inspect any stop or play one finite, reader-controlled pass over each exact incoming relationship.','f7-tag':'INSPECT · PLAY · PAUSE',
- 'label-palette':'Design system',
- 'palette-h2':'Color that <em>means something.</em>',
- 'palette-body':'Seven node colours, consistent in both themes. The legend renames them for your story — Backend can read as Vacation, Security as Rule.',
- 'chip-frontend':'Frontend','chip-frontend-use':'Client apps, browsers, mobile, UI',
- 'chip-backend':'Backend','chip-backend-use':'Services, APIs, workers, daemons',
- 'chip-database':'Database','chip-database-use':'DBs, caches, stores, AI/ML',
- 'chip-cloud':'Cloud','chip-cloud-use':'Managed services, infra',
- 'chip-security':'Security','chip-security-use':'Auth, secrets, guards',
- 'chip-bus':'Message Bus','chip-bus-use':'Kafka, RabbitMQ, SNS',
- 'chip-external':'External','chip-external-use':'Users, 3rd parties, generic',
- 'label-qs':'Quick start',
- 'qs-h2':'Three steps. <em>One command.</em>',
- 'qs-body':'One checked Skill for Claude Code, Codex, Cursor, OpenCode, and GitHub Copilot. Pick your agent for the exact command.',
- 'term-c1':'# Install globally for your agent','term-c2':'# Or try it once with Codex, no permanent install','term-c3':'# Then just ask',
- 'term-ask':'› Use Archify to plan my annual leave: 10 days, plus 2 comp days that expire at the end of June.',
- 'step1-h':'Install in one command','step1-p':'Run the command for your agent, or open the <a href="start.html?agent=cursor&amp;type=architecture">agent-aware quick start</a> for project-scoped installs.',
- 'step2-h':'Describe your system','step2-p':'Describe the steps, people, parts, or states — or ask your agent to read a repository first.',
- 'step3-h':'Ask your agent to draw it','step3-p':'Tell your agent to use Archify. It generates a self-contained HTML file you can open in any browser and refine in chat.',
- 'kbd-label':'Inside every artifact','kbd-guide':'Diagram guide','kbd-theme':'Toggle theme','kbd-find':'Find node / route endpoint','kbd-route':'Trace, inspect, and play a route','kbd-radar':'Semantic radar','kbd-lens':'Compare semantic kinds','kbd-present':'Presentation stage','kbd-export':'Open export menu','kbd-focus':'Focus node','kbd-zoom':'Reading depth / reset','kbd-nav':'Navigate menu','kbd-close':'Close menu',
- 'footer-meta':'stable &nbsp;·&nbsp; v[[ARCHIFY_VERSION]] &nbsp;·&nbsp; MIT License<br>Based on Cocoon-AI/architecture-diagram-generator',
- 'cta-h':'Describe it once.<br><em>Share the map.</em>',
- 'cta-sub':'One command installs the checked skill for your agent — and your next diagram is a chat message away.',
- 'cta-install':'Install the skill','cta-gh':'Star on GitHub',
- 'footer-changelog':'Changelog','footer-license':'License','footer-community':'Community'
- },
- zh: {
- 'label-life':'不只是代码',
- 'life-h2':'不只是代码,<br><em>生活里的事也能画。</em>',
- 'life-body':'年假规划、求职进度、租房沟通、每月收支——下面每一张都是真实生成的 Archify 成品,和系统架构图走同一套生成与校验流程。点开就能探索。',
- 'life-note':'示例里的数字仅作演示。描述你自己的情况,Agent 就会画出你的那一张。',
- 'life-leave-k':'工作流',
- 'life-leave-q':'一年的假怎么排最划算?',
- 'life-job-k':'生命周期',
- 'life-job-q':'每份求职申请走到哪一步了?',
- 'life-money-k':'数据流',
- 'life-money-q':'工资每个月都去哪了?',
- 'life-rent-k':'时序图',
- 'life-rent-q':'租房时,谁跟谁说了什么?',
- 'arch-k':'架构图',
- 'wf-k':'工作流',
- 'seq-k':'时序图',
- 'flow-k':'数据流',
- 'life-k':'生命周期',
- 'nav-guide':'场景指南','nav-gallery':'验证作品集','nav-start':'快速上手','nav-community':'社区包','nav-install':'安装技能',
- 'hero-badge':'稳定版 Agent 技能 · 查看更新','hero-works':'支持',
- 'hero-h1':'<span class="l">用大白话讲清楚,</span><span class="l">得到<em>一张可信的图。</em></span>',
- 'hero-sub':'年假怎么排、求职走到哪步、工资去哪了,或者一整套软件系统——只要它有步骤、组成、关系或状态,你的 AI Agent 都能把它变成一张可以点开探索、交付前已经校验过的 HTML 图。',
- 'hero-cta':'开始使用','hero-stars':'GitHub Star','copy':'复制','copied':'已复制',
- 'demo-watch':'观看 35 秒演示','demo-title':'Archify 35 秒演示','demo-close':'关闭演示',
- 'tour-title':'实时成品导览',
- 'proof-live':'实时','proof-open':'打开完整成品',
- 'beat-0-k':'全景','beat-1-k':'聚焦','beat-2-k':'上游','beat-3-k':'语义镜头',
- 'beat-0-t':'整个系统,一屏读完。','beat-0-b':'这是真实生成的成品,不是截图。泳道、边界和每一条作者连线都在这里——继续滚动,移动它的镜头。',
- 'beat-1-t':'聚焦一个节点,看清它驱动了什么。','beat-1-b':'在任意节点上按 Enter,或打开一个稳定链接,镜头会只保留它下游的一切。',
- 'beat-2-t':'反转方向,找到源头。','beat-2-b':'向上游追溯,看清喂给这一步的每个依赖。同一个文件、同一组作者关系,只改一次 hash。',
- 'beat-3-t':'按语义对比,而不是按方框。','beat-3-b':'语义镜头只保留你点名的类型——安全对数据、后端对存储——其余全部压暗。',
- 'stat-types':'图表类型','stat-presets':'视觉预设','stat-checks':'每个成品的校验项','stat-export':'原生导出倍率','stat-deps':'运行时依赖',
- 'label-types':'图表类型',
- 'types-h2':'五个问题,<br><em>五种图。</em>',
- 'types-body':'问你真正想问的问题。Archify 会选出能回答它的那种图——不管是一套软件系统、一份计划,还是你自己生活里的事。',
- 'types-more':'浏览完整作品集','types-more-sub':'实时成品 · 全部预设 · 全部图型',
- 'arch-h':'它由什么组成?',
- 'arch-p':'一件事由哪些部分组成、彼此怎么连接——家里的账户和银行卡、团队分工,或者云上系统的服务、数据库与安全边界。',
- 'arch-li1':'家庭账户','arch-li2':'团队分工','arch-li3':'微服务拓扑','arch-li4':'云与安全边界',
- 'wf-h':'下一步做什么?',
- 'wf-p':'跨人、跨阶段的步骤——办签证、排年假、新人入职、审批链,或者 CI/CD 流水线,逐泳道铺开。',
- 'seq-h':'谁先谁后,怎么来回?',
- 'seq-p':'按顺序的一来一回——通过中介租房、报销往返,或者带返回值的 API 调用链。',
- 'flow-h':'东西都流向哪里?',
- 'flow-p':'东西从哪来、最后落到哪——工资流向账单和储蓄、文件流转审阅,或者数据穿过管道。',
- 'life-h':'现在走到哪一步了?',
- 'life-p':'有哪些状态、怎么在状态之间变化——求职申请、一笔订单、护照换发或一次部署,含等待、重试和结局。',
- 'label-features':'输出',
- 'features-h2':'一个文件,<br><em>全部都在里面。</em>',
- 'cmp-light':'浅色','cmp-dark':'深色',
- 'fv1-h':'双主题输出','fv1-p':'每张图都内置协调的深色与浅色变量集:HTML 的主题开关与 SVG 的 @media prefers-color-scheme 规则同步切换——一个文件,自动跟随读者主题。','fv1-tag':'浅色 · 深色 · 单文件',
- 'fv2-h':'一个菜单,全部格式','fv2-p':'PNG、JPEG、WebP、双主题 SVG、WebM 动图,或直接复制到剪贴板——所有导出都在浏览器内原生渲染,同一个菜单完成。',
- 'exp-clip-fmt':'剪贴板',
- 'f2-h':'超清 4× 导出','f2-p':'PNG、JPEG、WebP——由浏览器以最高 4 倍分辨率原生栅格化,无上采样模糊。视网膜屏、幻灯片、印刷均清晰。',
- 'f5-h':'独立 HTML 文件','f5-p':'单个 HTML 文件,零依赖、无需服务器或构建工具,任意浏览器打开即用。作为附件发邮件或贴 PR 评论均可。',
- 'f6-h':'对话式迭代','f6-p':'「把暑假旅行挪到八月」「加一个 Redis」「把截止日标红」——用大白话精调,不用学任何画图工具。',
- 'f7-h':'检查并播放真实路径','f7-p':'Route Journey 始终保留完整作者路径,可逐站检查,也可沿每条精确入向关系播放一次由读者控制的有限旅程。','f7-tag':'检查 · 播放 · 暂停',
- 'label-palette':'设计系统',
- 'palette-h2':'每种颜色,<br><em>都有含义。</em>',
- 'palette-body':'七种节点颜色,深浅主题下保持一致。图例可以按你的故事改名——「后端」可以叫「假期」,「安全」可以叫「规则」。',
- 'chip-frontend':'前端','chip-frontend-use':'客户端、浏览器、移动端、UI',
- 'chip-backend':'后端','chip-backend-use':'服务、API、Worker、守护进程',
- 'chip-database':'数据库','chip-database-use':'数据库、缓存、存储、AI/ML',
- 'chip-cloud':'云服务','chip-cloud-use':'托管服务、基础设施',
- 'chip-security':'安全','chip-security-use':'鉴权、密钥、安全网关',
- 'chip-bus':'消息总线','chip-bus-use':'Kafka、RabbitMQ、SNS',
- 'chip-external':'外部系统','chip-external-use':'用户、第三方、通用外部',
- 'label-qs':'快速开始',
- 'qs-h2':'三步上手,<br><em>一条命令。</em>',
- 'qs-body':'同一份经过检查的 Skill 可用于 Claude Code、Codex、Cursor、OpenCode 和 GitHub Copilot。选择你的 Agent,获取准确命令。',
- 'term-c1':'# 为你的 Agent 全局安装','term-c2':'# 或者用临时副本在 Codex 中试一次','term-c3':'# 然后直接说',
- 'term-ask':'› 用 Archify 帮我排一下今年的年假:10 天年假,加 2 天 6 月底过期的调休。',
- 'step1-h':'一条命令安装','step1-p':'运行对应 Agent 的命令,或打开<a href="start.html?agent=cursor&amp;type=architecture">可切换 Agent 的快速开始页</a>获取项目级安装命令。',
- 'step2-h':'描述你的系统','step2-p':'描述步骤、角色、组成或状态,也可以先让 agent 读一下代码仓库。',
- 'step3-h':'让 agent 绘制','step3-p':'告诉 agent 使用 Archify,它会生成可在任意浏览器打开的单文件 HTML,并可继续在对话中迭代。',
- 'kbd-label':'每个成品都内置','kbd-guide':'图表指南','kbd-theme':'切换主题','kbd-find':'查找节点 / 路径端点','kbd-route':'探查、检查并播放路径','kbd-radar':'语义雷达','kbd-lens':'对比语义类型','kbd-present':'演示舞台','kbd-export':'打开导出菜单','kbd-focus':'聚焦节点','kbd-zoom':'阅读层级 / 复位','kbd-nav':'菜单导航','kbd-close':'关闭菜单',
- 'footer-meta':'稳定版 &nbsp;·&nbsp; v[[ARCHIFY_VERSION]] &nbsp;·&nbsp; MIT 许可证<br>基于 Cocoon-AI/architecture-diagram-generator',
- 'cta-h':'描述一次,<br><em>分享这张图。</em>',
- 'cta-sub':'一条命令为你的 Agent 安装经过检查的技能——下一张架构图,只差一句对话。',
- 'cta-install':'安装技能','cta-gh':'在 GitHub 上 Star',
- 'footer-changelog':'更新日志','footer-license':'许可证','footer-community':'社区包'
- }
- };
+ const LANGS = JSON.parse(document.getElementById('site-copy').textContent);
+ const DEFAULT_PROOF_LABELS = JSON.parse(document.getElementById('site-proof-labels').textContent);
/* The MAP beat clears focus/lens with a fragment that names no element: an
empty '#' would make the browser scroll the indicated "top of document"
@@ -184,8 +20,8 @@
beats: [MAP, '#focus=planner&reach=downstream', '#focus=approval&reach=upstream', '#lens=security~database'],
iframeTitle: { en: 'Agent Tool Call live Archify proof', zh: '智能体工具调用 Archify 实时成品' },
name: { en: 'Agent Tool Call', zh: '智能体工具调用' },
- meta: { en: 'Workflow · Signal Flow · 12 nodes · 11 edges', zh: '工作流 · Signal Flow · 12 节点 · 11 条关系' },
- title: { en: 'Agent Tool Call — policy, execution, recovery, and evidence', zh: '智能体工具调用——策略、执行、恢复与证据闭环' }
+ meta: DEFAULT_PROOF_LABELS.meta,
+ title: DEFAULT_PROOF_LABELS.title
},
blueprint: {
artifact: 'gallery/artifacts/production-deployment.architecture.html',
@@ -316,7 +152,7 @@
function applyLang(l) {
lang = ArchifySiteLanguage.write(l);
- document.documentElement.lang = lang === 'zh' ? 'zh-CN' : 'en';
+ document.documentElement.lang = lang === 'zh' ? 'zh-Hans' : 'en';
btnLang.textContent = lang === 'zh' ? 'EN' : '中文';
btnLang.setAttribute('aria-label', lang === 'zh' ? 'Switch to English' : '切换到中文');
const dict = LANGS[lang];
@@ -327,7 +163,6 @@
renderProof(activeProof);
}
- btnLang.addEventListener('click', () => applyLang(lang === 'en' ? 'zh' : 'en'));
applyLang(lang);
/* ══ Reveal on enter ══ */
diff --git a/website/src/scripts/site-language.js b/website/src/scripts/site-language.js
new file mode 100644
index 00000000..476a36bb
--- /dev/null
+++ b/website/src/scripts/site-language.js
@@ -0,0 +1,56 @@
+(function (global) {
+ 'use strict';
+ var config = JSON.parse(document.getElementById('site-route').textContent);
+ var language = config.lang;
+ var normalize = function (value) { return value === 'en' || value === 'zh' ? value : null; };
+ function pagePath(page, lang) {
+ if (page === 'index') return lang === 'zh' ? 'zh' + (config.cloudflare ? '' : '.html') : './';
+ return (lang === 'zh' ? 'zh/' : '') + page + (config.cloudflare ? '' : '.html');
+ }
+ function destination(lang) {
+ var current = new URL(global.location.href);
+ var next = new URL(pagePath(config.page, lang), document.baseURI);
+ current.searchParams.delete('lang');
+ next.search = current.search;
+ next.hash = current.hash;
+ return next;
+ }
+ // An explicit legacy query requests a route. Stored preferences never override a URL.
+ var current = new URL(global.location.href);
+ if (current.searchParams.has('lang')) {
+ var requested = normalize(current.searchParams.get('lang'));
+ current.searchParams.delete('lang');
+ if (requested && requested !== language) {
+ global.location.replace(destination(requested).href);
+ } else {
+ try { global.history.replaceState(global.history.state, '', current.href); } catch (_) {}
+ }
+ }
+ function localizeLinks() {
+ document.querySelectorAll('a[href]').forEach(function (link) {
+ if (link.hasAttribute('data-language-switch')) return;
+ var match = link.getAttribute('href').match(/^(index|guide|start|gallery|community)\.html([?#].*)?$/);
+ if (match) link.setAttribute('href', pagePath(match[1], language) + (match[2] || ''));
+ });
+ }
+ global.ArchifySiteLanguage = Object.freeze({
+ key: 'archify-lang',
+ read: function () { return language; },
+ write: function () {
+ try { global.localStorage.setItem('archify-lang', language); } catch (_) {}
+ return language;
+ },
+ page: function (page, suffix) { return pagePath(page, language) + (suffix || ''); },
+ localizeLinks: localizeLinks,
+ });
+ document.addEventListener('DOMContentLoaded', function () {
+ localizeLinks();
+ document.querySelectorAll('[data-language-switch]').forEach(function (link) {
+ function sync() { link.href = destination(language === 'zh' ? 'en' : 'zh').href; }
+ sync();
+ link.addEventListener('pointerdown', sync);
+ link.addEventListener('focus', sync);
+ link.addEventListener('click', sync);
+ });
+ });
+}(window));
diff --git a/website/src/scripts/start.js b/website/src/scripts/start.js
index 535ecb18..2d2e44e0 100644
--- a/website/src/scripts/start.js
+++ b/website/src/scripts/start.js
@@ -3,7 +3,7 @@
'use strict';
var DATA = JSON.parse(document.getElementById('start-data').textContent);
- var KNOWN_TYPES = new Set(['architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle']);
+ var KNOWN_TYPES = new Set(Object.keys(DATA));
var KNOWN_AGENTS = new Set(['cursor', 'codex', 'claude-code', 'opencode', 'github-copilot']);
var KNOWN_INPUTS = new Set(['description', 'repository']);
var KNOWN_SOURCES = new Set(['artifact', 'gallery', 'readme', 'direct']);
@@ -36,7 +36,7 @@
}
function updateStaticCopy() {
- document.documentElement.lang = language === 'zh' ? 'zh-CN' : 'en';
+ document.documentElement.lang = language === 'zh' ? 'zh-Hans' : 'en';
document.querySelectorAll('[data-en][data-zh]').forEach(function (element) {
element.textContent = copyForElement(element);
});
@@ -119,7 +119,7 @@
entry.textContent = item;
return entry;
}));
- proofLink.href = 'gallery.html#proof-' + encodeURIComponent(recipe.proof);
+ proofLink.href = ArchifySiteLanguage.page('gallery', '#proof-' + encodeURIComponent(recipe.proof));
proofMeta.textContent = language === 'zh'
? '验证成品 · ' + recipe.presentation.preset + ' · ' + recipe.presentation.motion
: 'Verified proof · ' + recipe.presentation.preset + ' · ' + recipe.presentation.motion;
@@ -231,10 +231,6 @@
copyText(starterText(), 'starter_copy');
});
proofLink.addEventListener('click', function () { recordStep('proof_open'); });
- languageButton.addEventListener('click', function () {
- language = language === 'zh' ? 'en' : 'zh';
- render();
- });
render();
recordStep('start_view');
diff --git a/website/src/styles/community.css b/website/src/styles/community.css
index 5a449c3e..4633c92a 100644
--- a/website/src/styles/community.css
+++ b/website/src/styles/community.css
@@ -73,8 +73,8 @@
border-radius: 14px;
background: var(--paper-raised);
overflow: hidden;
- opacity: 0;
- transform: translateY(18px);
+ opacity: 1;
+ transform: none;
transition: opacity .5s var(--ease-out), transform .5s var(--ease-out), border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
transition-delay: calc(var(--stagger, 0) * 60ms), calc(var(--stagger, 0) * 60ms), 0s, 0s;
}
diff --git a/website/src/styles/gallery.css b/website/src/styles/gallery.css
index 959f3f44..443e01d1 100644
--- a/website/src/styles/gallery.css
+++ b/website/src/styles/gallery.css
@@ -57,8 +57,8 @@
border: 1px solid var(--line-hi);
border-radius: 14px;
background: var(--paper-raised);
- opacity: 0;
- transform: translateY(18px);
+ opacity: 1;
+ transform: none;
transition: opacity .5s var(--ease-out), transform .5s var(--ease-out), border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.showcase-card.visible { opacity: 1; transform: translateY(0); }
diff --git a/website/src/styles/index.css b/website/src/styles/index.css
index 09c6585f..b80a068b 100644
--- a/website/src/styles/index.css
+++ b/website/src/styles/index.css
@@ -13,8 +13,8 @@
.container { position:relative; z-index:1; max-width:var(--shell); margin:0 auto; padding:0 2rem; }
section { position:relative; }
- /* FADE — develop in */
- .fade-up { opacity:0; transform:translateY(18px); filter:blur(6px); transition:opacity .9s var(--ease-out),transform .9s var(--ease-out),filter .9s var(--ease-out); }
+ /* Content is visible before JavaScript; reveal classes remain optional decoration. */
+ .fade-up { opacity:1; transform:none; filter:none; transition:opacity .9s var(--ease-out),transform .9s var(--ease-out),filter .9s var(--ease-out); }
.fade-up.visible { opacity:1; transform:none; filter:none; }
.fade-up.d1 { transition-delay:.08s; } .fade-up.d2 { transition-delay:.16s; }
.fade-up.d3 { transition-delay:.24s; } .fade-up.d4 { transition-delay:.32s; }
@@ -78,9 +78,9 @@
.hero h1 em { font-family:var(--font-display); font-style:italic; font-optical-sizing:auto; font-weight:400; letter-spacing:-.03em; padding-right:.06em;
background:linear-gradient(100deg,var(--grad-a) 0%,var(--accent) 45%,var(--grad-c) 100%); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.hero h1 em { white-space:nowrap; padding-left:.12em; margin-left:-.12em; }
- html[lang="zh-CN"] .hero h1 { letter-spacing:-.02em; line-height:1.08; }
+ html[lang^="zh"] .hero h1 { letter-spacing:-.02em; line-height:1.08; }
/* CJK has no true italic — use upright heavy strokes for the accent instead of a synthesized slant */
- html[lang="zh-CN"] .hero h1 em, html[lang="zh-CN"] .section-heading em, html[lang="zh-CN"] .cta-h em { font-family:var(--font-grot); font-style:normal; font-weight:600; letter-spacing:-.01em; }
+ html[lang^="zh"] .hero h1 em, html[lang^="zh"] .section-heading em, html[lang^="zh"] .cta-h em { font-family:var(--font-grot); font-style:normal; font-weight:600; letter-spacing:-.01em; }
.hero-sub { max-width:64ch; margin-top:1.5rem; font-size:1.0625rem; line-height:1.65; color:var(--text-2); text-wrap:pretty; }
.hero-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:.75rem; margin-top:2.25rem; }
@@ -176,7 +176,7 @@
.section-label::after { content:''; width:3rem; height:1px; background:var(--line-hi); }
.section-heading { font-family:var(--font-grot); font-size:clamp(2.25rem,4.6vw,4rem); font-weight:500; letter-spacing:-.04em; line-height:1.02; color:var(--text); text-wrap:balance; }
.section-heading em, .cta-h em { font-family:var(--font-display); font-style:italic; font-weight:400; letter-spacing:-.025em; color:var(--accent); }
- html[lang="zh-CN"] .section-heading { letter-spacing:-.01em; line-height:1.15; }
+ html[lang^="zh"] .section-heading { letter-spacing:-.01em; line-height:1.15; }
.section-body { margin-top:1.25rem; max-width:560px; font-size:1rem; line-height:1.7; color:var(--text-2); text-wrap:pretty; }
/* ══════════════════════════════════════
@@ -301,7 +301,7 @@
.steps { list-style:none; display:flex; flex-direction:column; gap:2rem; padding-top:.5rem; }
.step { display:grid; grid-template-columns:40px 1fr; gap:1.1rem; }
.step-num { width:40px; height:40px; display:flex; align-items:center; justify-content:center; border-radius:50%; border:1px solid var(--line-hi); font-family:var(--font-display); font-style:italic; font-size:1.25rem; color:var(--accent); }
- .step h4 { font-family:var(--font-grot); font-size:1.125rem; font-weight:500; letter-spacing:-.015em; color:var(--text); margin:.35rem 0 .4rem; }
+ .step h3 { font-family:var(--font-grot); font-size:1.125rem; font-weight:500; letter-spacing:-.015em; color:var(--text); margin:.35rem 0 .4rem; }
.step p { font-size:.875rem; line-height:1.65; color:var(--text-2); text-wrap:pretty; }
.step a { color:var(--accent); text-decoration:none; border-bottom:1px solid rgba(var(--accent-rgb),.4); }
.step a:hover { border-bottom-color:var(--accent); }
@@ -322,7 +322,7 @@
.cta-glow::before { content:''; position:absolute; inset:0; background-image:linear-gradient(rgba(var(--fg-rgb),.04) 1px,transparent 1px),linear-gradient(90deg,rgba(var(--fg-rgb),.04) 1px,transparent 1px); background-size:64px 64px; -webkit-mask-image:radial-gradient(ellipse 60% 70% at 50% 100%,#000,transparent 75%); mask-image:radial-gradient(ellipse 60% 70% at 50% 100%,#000,transparent 75%); }
.cta-inner { display:flex; flex-direction:column; align-items:center; }
.cta-h { font-family:var(--font-grot); font-size:clamp(2.75rem,7vw,6.25rem); font-weight:500; letter-spacing:-.045em; line-height:1; color:var(--text); text-wrap:balance; }
- html[lang="zh-CN"] .cta-h { letter-spacing:-.015em; line-height:1.12; }
+ html[lang^="zh"] .cta-h { letter-spacing:-.015em; line-height:1.12; }
.cta-sub { max-width:520px; margin-top:1.75rem; font-size:1.0625rem; line-height:1.65; color:var(--text-2); text-wrap:pretty; }
.cta-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:.75rem; margin-top:2.5rem; }
diff --git a/website/src/styles/site.css b/website/src/styles/site.css
index da229993..881513f2 100644
--- a/website/src/styles/site.css
+++ b/website/src/styles/site.css
@@ -71,7 +71,7 @@
/* page titles — grotesk statement, Fraunces italic accent */
h1 { background:linear-gradient(180deg,var(--title-top) 0%,var(--title-top) 55%,var(--title-end) 100%); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
- html[lang="zh-CN"] h1 em { font-family:inherit!important; font-style:normal!important; font-weight:600!important; }
+ html[lang^="zh"] h1 em { font-family:inherit!important; font-style:normal!important; font-weight:600!important; }
h1 em { padding-right:.06em; background:linear-gradient(100deg,var(--grad-a) 0%,var(--accent) 45%,var(--grad-c) 100%); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
/* ══════════════════════════════════════
@@ -136,7 +136,7 @@
/* small mono labels — legible size, and no wide tracking on CJK */
.lead-label, .proof-label, .controls-note, .metric span, .type-label, .panel-kicker, .agent-picker-head, .mini-heading, .result-kicker, .card-type, .card-kicker, .receipt-label, .method-code-bar { font-size:.6875rem!important; }
- html[lang="zh-CN"] :is(.lead-label, .proof-label, .controls-note, .metric span, .type-label, .panel-kicker, .agent-picker-head, .mini-heading, .result-kicker, .method-code-bar) { letter-spacing:.04em!important; }
+ html[lang^="zh"] :is(.lead-label, .proof-label, .controls-note, .metric span, .type-label, .panel-kicker, .agent-picker-head, .mini-heading, .result-kicker, .method-code-bar) { letter-spacing:.04em!important; }
/* sticky filter bars ride under the navigation */
.controls { position:sticky; top:64px; z-index:20; background:rgba(var(--bg-rgb),.78); backdrop-filter:blur(16px) saturate(1.3); -webkit-backdrop-filter:blur(16px) saturate(1.3); }
diff --git a/website/test/cloudflare-output.test.mjs b/website/test/cloudflare-output.test.mjs
index a7aa1868..54adc229 100644
--- a/website/test/cloudflare-output.test.mjs
+++ b/website/test/cloudflare-output.test.mjs
@@ -8,9 +8,16 @@ import { checkCloudflareOutput } from '../scripts/check-cloudflare-output.mjs';
function fixture(t) {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-cloudflare-output-'));
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
- for (const name of ['index', 'gallery', 'guide', 'start', 'community', '404']) {
- fs.writeFileSync(path.join(root, `${name}.html`), '<!doctype html><title>Archify</title>');
+ const names = ['index', 'gallery', 'guide', 'start', 'community', 'zh', 'zh/gallery', 'zh/guide', 'zh/start', 'zh/community'];
+ const urls = names.map(name => `https://archify.si/${name === 'index' ? '' : name}`);
+ for (const [index, name] of names.entries()) {
+ fs.mkdirSync(path.dirname(path.join(root, `${name}.html`)), { recursive: true });
+ fs.writeFileSync(path.join(root, `${name}.html`), `<!doctype html><title>Archify</title><link rel="canonical" href="${urls[index]}">`);
}
+ fs.writeFileSync(path.join(root, '404.html'), '<!doctype html><title>Not found</title>');
+ fs.writeFileSync(path.join(root, 'sitemap.xml'), `<urlset>${urls.map(url => `<url><loc>${url}</loc></url>`).join('')}</urlset>`);
+ fs.writeFileSync(path.join(root, 'robots.txt'), 'User-agent: *\nAllow: /\n\nSitemap: https://archify.si/sitemap.xml\n');
+ fs.writeFileSync(path.join(root, '_headers'), '/*.json\n X-Robots-Tag: noindex\n');
fs.writeFileSync(path.join(root, 'site.css'), 'body { color: black; }');
fs.appendFileSync(path.join(root, 'index.html'), '<link href="site.css" rel="stylesheet"><a href="/guide?lang=zh#install">Guide</a>');
const manifest = path.join(root, 'skill-updates/archify/stable.json');
@@ -20,7 +27,7 @@ function fixture(t) {
}
test('Cloudflare output accepts static files and extensionless canonical routes', t => {
- assert.equal(checkCloudflareOutput(fixture(t)), 6);
+ assert.equal(checkCloudflareOutput(fixture(t)), 11);
});
test('Cloudflare output rejects a missing 404 before implicit SPA fallback can ship', t => {
@@ -48,3 +55,12 @@ test('Cloudflare output rejects an asset exceeding the Pages upload limit', t =>
fs.truncateSync(asset, 25 * 1024 * 1024 + 1);
assert.throws(() => checkCloudflareOutput(root), /asset exceeds 25 MiB/);
});
+
+
+test('Cloudflare output resolves nested-page assets against the HTML base', t => {
+ const root = fixture(t);
+ fs.appendFileSync(path.join(root, 'zh/guide.html'), '<base href="../"><link href="site.css" rel="stylesheet">');
+ assert.equal(checkCloudflareOutput(root), 11);
+ fs.rmSync(path.join(root, 'site.css'));
+ assert.throws(() => checkCloudflareOutput(root), /missing local target site\.css/);
+});
diff --git a/website/test/community-browser.test.mjs b/website/test/community-browser.test.mjs
index fc297a54..8a16993b 100644
--- a/website/test/community-browser.test.mjs
+++ b/website/test/community-browser.test.mjs
@@ -18,16 +18,17 @@ test('real Chrome: community metadata remains text through language, filter and
assert.ok(chrome, 'The requested community integration gate requires usable Chrome.');
const fixture = createCommunityFixture();
let server;
+ let fixtureServer;
let browser;
try {
const built = fixture.build();
assert.equal(built.status, 0, built.stdout + built.stderr);
- server = http.createServer((request, response) => {
+ const serve = (root, mount) => http.createServer((request, response) => {
const url = new URL(request.url, 'http://127.0.0.1');
- const isFixture = url.pathname.startsWith('/fixture/');
- const root = isFixture ? fixture.dist : siteRoot;
- if (!isFixture && siteBase && !url.pathname.startsWith(`${siteBase}/`)) return response.writeHead(404).end();
- const relative = url.pathname.slice(isFixture ? '/fixture/'.length : siteBase.length).replace(/^\/+/, '');
+ if (mount && !url.pathname.startsWith(`${mount}/`)) return response.writeHead(404).end();
+ let relative = url.pathname.slice(mount.length).replace(/^\/+/, '') || 'index.html';
+ // Serve only actual file-format routes; never introduce an SPA fallback.
+ if (['zh', 'start', 'guide', 'gallery', 'community', 'zh/start', 'zh/guide', 'zh/gallery', 'zh/community'].includes(relative)) relative += '.html';
const file = path.resolve(root, relative);
if (!file.startsWith(`${root}${path.sep}`)) return response.writeHead(404).end();
try {
@@ -36,8 +37,11 @@ test('real Chrome: community metadata remains text through language, filter and
response.end(fs.readFileSync(file));
} catch { response.writeHead(404).end(); }
});
- await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
+ server = serve(siteRoot, siteBase);
+ fixtureServer = serve(fixture.dist, '/archify');
+ await Promise.all([server, fixtureServer].map(server => new Promise(resolve => server.listen(0, '127.0.0.1', resolve))));
const base = `http://127.0.0.1:${server.address().port}`;
+ const fixtureBase = `http://127.0.0.1:${fixtureServer.address().port}/archify`;
browser = new ChromeVisualBrowser(chrome);
const session = await browser.sessionPromise;
const evaluate = async expression => {
@@ -50,6 +54,11 @@ test('real Chrome: community metadata remains text through language, filter and
await browser.cdp.send('Page.navigate', { url }, session);
await loaded;
};
+ const switchLanguage = async () => {
+ const loaded = browser.cdp.waitFor('Page.loadEventFired', session);
+ await evaluate("document.getElementById('language').click()");
+ await loaded;
+ };
const assertText = async language => {
const state = await evaluate(`({
language: document.documentElement.lang,
@@ -61,7 +70,7 @@ test('real Chrome: community metadata remains text through language, filter and
heroMarkup: !!document.querySelector('h1 br') && !!document.querySelector('h1 em'),
width: document.documentElement.scrollWidth, viewport: innerWidth
})`);
- assert.equal(state.language, language === 'en' ? 'en' : 'zh-CN');
+ assert.equal(state.language, language === 'en' ? 'en' : 'zh-Hans');
assert.equal(state.executed, null);
assert.equal(state.summary, language === 'en' ? payload : `测试 ${payload}`);
assert.deepEqual(state.evidence, fixture.entry.evidence.map(item => ({ text: `${item.label} ↗`, href: item.url })));
@@ -73,28 +82,29 @@ test('real Chrome: community metadata remains text through language, filter and
for (const width of [1440, 390]) {
await browser.cdp.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false }, session);
for (const language of ['en', 'zh']) {
- await navigate(`${base}/fixture/community.html?lang=${language}`);
+ await navigate(`${fixtureBase}/${language === 'zh' ? 'zh/' : ''}community.html`);
await assertText(language);
- await evaluate("document.getElementById('language').click()");
+ await switchLanguage();
await assertText(language === 'en' ? 'zh' : 'en');
- await evaluate("document.getElementById('language').click()");
+ await switchLanguage();
await assertText(language);
}
await evaluate("document.querySelector('[data-filter=recipe]').click()");
assert.deepEqual(await evaluate(`({ visible: [...document.querySelectorAll('.package-card')].filter(node => !node.hidden).length, empty: getComputedStyle(document.getElementById('empty-state')).display, type: new URL(location.href).searchParams.get('type') })`), { visible: 0, empty: 'block', type: 'recipe' });
- await navigate(`${base}/fixture/community.html?type=skill&lang=en`);
+ await navigate(`${fixtureBase}/community.html?type=skill`);
assert.equal(await evaluate("document.querySelector('[data-filter=skill]').getAttribute('aria-pressed')"), 'true');
assert.equal(await evaluate("document.querySelector('.package-card').hidden"), false);
- await navigate(`${base}${siteBase}/index.html?lang=zh`);
+ await navigate(`${base}${siteBase}/${siteBase ? 'zh.html' : 'zh'}`);
const loaded = browser.cdp.waitFor('Page.loadEventFired', session);
- await evaluate("document.querySelector('footer a[href=\"community.html\"]').click()");
+ await evaluate(`document.querySelector('footer a[href="zh/community${siteBase ? ".html" : ""}"]').click()`);
await loaded;
- assert.equal(await evaluate('document.documentElement.lang'), 'zh-CN');
- assert.equal(await evaluate('location.pathname'), `${siteBase}/community.html`);
+ assert.equal(await evaluate('document.documentElement.lang'), 'zh-Hans');
+ assert.equal(await evaluate('location.pathname'), `${siteBase}/zh/community${siteBase ? ".html" : ""}`);
}
} finally {
if (browser) await browser.close();
if (server) await new Promise(resolve => server.close(resolve));
+ if (fixtureServer) await new Promise(resolve => fixtureServer.close(resolve));
fixture.close();
}
});
diff --git a/website/test/community-build.test.mjs b/website/test/community-build.test.mjs
index e66f6fdc..cac0084d 100644
--- a/website/test/community-build.test.mjs
+++ b/website/test/community-build.test.mjs
@@ -22,10 +22,12 @@ test('community catalog: real build rejects invalid metadata before displaying P
fixture.write(fixture.entry);
const accepted = fixture.build();
assert.equal(accepted.status, 0, accepted.stdout + accepted.stderr);
- const html = fs.readFileSync(path.join(fixture.dist, 'community.html'), 'utf8');
- assert.ok(html.includes('https://example.com/receipt'));
- assert.ok(html.includes('https://example.com/example'));
- assert.ok(!html.includes(payload), 'untrusted markup must be escaped during SSR');
+ for (const file of ['community.html', 'zh/community.html']) {
+ const html = fs.readFileSync(path.join(fixture.dist, file), 'utf8');
+ assert.ok(html.includes('https://example.com/receipt'), file);
+ assert.ok(html.includes('https://example.com/example'), file);
+ assert.ok(!html.includes(payload), `${file}: untrusted markup must be escaped during SSR`);
+ }
} finally {
fixture.close();
}
diff --git a/website/test/community.test.mjs b/website/test/community.test.mjs
index 6a8a9bc2..c0e284b4 100644
--- a/website/test/community.test.mjs
+++ b/website/test/community.test.mjs
@@ -70,10 +70,16 @@ test('community catalog: filter buttons cover the types present in the registry'
test('community catalog: navigation, language toggle and disclaimer are present', () => {
const dom = communityDom();
- const links = elements(dom, 'a').map((node) => attr(node, 'href'));
- assert.ok(links.includes('community.html'), 'primary navigation must link to community.html');
- const languageButton = elements(dom, 'button').find((node) => attr(node, 'id') === 'language');
- assert.ok(languageButton, 'language toggle must be present');
+ const bases = elements(dom, 'base');
+ assert.equal(bases.length, 1);
+ assert.equal(attr(bases[0], 'href'), './');
+ const baseUri = new URL(attr(bases[0], 'href'), 'https://tt-a1i.github.io/archify/community.html');
+ const links = elements(dom, 'a').map(node => new URL(attr(node, 'href'), baseUri).pathname);
+ assert.ok(links.includes('/archify/community.html'), 'primary navigation must link to the catalog under the Pages base');
+ const languageButton = elements(dom, 'a').find((node) => attr(node, 'id') === 'language');
+ assert.ok(languageButton, 'language route link must be present');
+ assert.equal(new URL(attr(languageButton, 'href'), baseUri).href, 'https://tt-a1i.github.io/archify/zh/community.html');
+ assert.equal(attr(languageButton, 'hreflang'), 'zh-Hans');
const html = fs.readFileSync(path.join(dist, 'community.html'), 'utf8');
assert.match(html, /Listing is not endorsement/, 'must carry the no-endorsement disclaimer');
const submission = elements(dom, 'a').find((node) => (attr(node, 'href') || '').includes('github.com/tt-a1i/archify/tree/main/community'));
diff --git a/website/test/deployment-target.test.mjs b/website/test/deployment-target.test.mjs
index 7c2fbda0..0338d8da 100644
--- a/website/test/deployment-target.test.mjs
+++ b/website/test/deployment-target.test.mjs
@@ -1,7 +1,9 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
-import { parse } from 'parse5';
+import { parse, parseFragment } from 'parse5';
+import { SEO_BLOCK_START, SEO_BLOCK_END, stripPublishedArtifactMetadata, artifactMetadata } from '../scripts/publish-seo.mjs';
+import { CASES } from '../src/data/gallery-presentation.mjs';
const cloudflare = process.env.ARCHIFY_SITE_TARGET === 'cloudflare';
const output = new URL(cloudflare ? '../dist-cloudflare/' : '../dist/', import.meta.url);
@@ -9,28 +11,66 @@ const nodes = node => [node, ...(node.childNodes || []).flatMap(nodes)];
const attr = (node, name) => node?.attrs?.find(item => item.name === name)?.value;
const pages = ['index', 'start', 'guide', 'gallery', 'community'];
-test('built deployment uses host-compatible generated assets and canonical metadata', () => {
- for (const page of pages) {
- const dom = parse(fs.readFileSync(new URL(`${page}.html`, output), 'utf8'));
+test('built deployment uses host-compatible generated assets and canonical metadata in both languages', () => {
+ for (const lang of ['en', 'zh']) for (const page of pages) {
+ const file = page === 'index' ? `${lang === 'zh' ? 'zh' : 'index'}.html` : `${lang === 'zh' ? 'zh/' : ''}${page}.html`;
+ const dom = parse(fs.readFileSync(new URL(file, output), 'utf8'));
const all = nodes(dom);
- const canonical = all.find(node => node.tagName === 'link' && attr(node, 'rel') === 'canonical');
- assert.equal(attr(canonical, 'href'), cloudflare ? `https://archify.si/${page === 'index' ? '' : page}` : undefined, page);
+ const canonicalUrl = `https://archify.si/${page === 'index' ? (lang === 'zh' ? 'zh' : '') : `${lang === 'zh' ? 'zh/' : ''}${page}`}`;
+ const bases = all.filter(node => node.tagName === 'base');
+ assert.equal(bases.length, 1, file);
+ assert.equal(attr(bases[0], 'href'), lang === 'zh' && page !== 'index' ? '../' : './', file);
+ const documentUrl = cloudflare ? canonicalUrl : `https://tt-a1i.github.io/archify/${file}`;
+ const baseUri = new URL(attr(bases[0], 'href'), documentUrl);
+ const nav = all.find(node => node.tagName === 'nav' && attr(node, 'class') === 'site-nav');
+ const navLinks = nodes(nav).filter(node => node.tagName === 'a' && (attr(node, 'class') || '').split(/\s+/).includes('nav-link'));
+ assert.deepEqual(navLinks.map(node => new URL(attr(node, 'href'), baseUri).href), [
+ ...['guide', 'gallery', 'start', 'community'].map(target => `${cloudflare ? 'https://archify.si/' : 'https://tt-a1i.github.io/archify/'}${lang === 'zh' ? 'zh/' : ''}${target}${cloudflare ? '' : '.html'}`),
+ 'https://github.com/tt-a1i/archify',
+ ], `${file}: routes resolved against the actual document base`);
+ const canonical = all.filter(node => node.tagName === 'link' && attr(node, 'rel') === 'canonical');
+ assert.equal(canonical.length, 1, file);
+ assert.equal(attr(canonical[0], 'href'), canonicalUrl, file);
+ const alternates = all.filter(node => node.tagName === 'link' && attr(node, 'rel') === 'alternate');
+ assert.deepEqual(alternates.map(node => [attr(node, 'hreflang'), attr(node, 'href')]), [
+ ['en', `https://archify.si/${page === 'index' ? '' : page}`],
+ ['zh-Hans', `https://archify.si/${page === 'index' ? 'zh' : `zh/${page}`}`],
+ ['x-default', `https://archify.si/${page === 'index' ? '' : page}`],
+ ], file);
const generatedAssets = all.flatMap(node => ['src', 'href'].map(name => attr(node, name))).filter(value => value?.includes('/_astro/'));
for (const asset of generatedAssets) {
assert.ok(asset.startsWith(cloudflare ? '/_astro/' : '/archify/_astro/'), asset);
const relative = asset.replace(cloudflare ? /^\// : /^\/archify\//, '').split(/[?#]/)[0];
- assert.ok(fs.existsSync(new URL(relative, output)), asset);
+ assert.ok(fs.statSync(new URL(relative, output)).isFile(), asset);
}
for (const property of ['og:url', 'og:image']) {
- const meta = all.find(node => attr(node, 'property') === property);
- if (meta) assert.ok(attr(meta, 'content').startsWith(cloudflare ? 'https://archify.si/' : 'https://tt-a1i.github.io/archify/'), `${page}: ${property}`);
+ const meta = all.filter(node => attr(node, 'property') === property);
+ assert.equal(meta.length, 1, `${file}: ${property}`);
+ assert.equal(attr(meta[0], 'content'), property === 'og:url' ? canonicalUrl : 'https://archify.si/assets/archify-social-preview.png');
}
}
});
-test('deployment preserves standalone proof and updater bytes and only Cloudflare gets a 404', () => {
- for (const file of ['gallery/artifacts/agent-tool-call.workflow.html', 'skill-updates/archify/stable.json', 'assets/site-language.js']) {
- assert.deepEqual(fs.readFileSync(new URL(file, output)), fs.readFileSync(new URL(`../../docs/${file}`, import.meta.url)), file);
+test('deployment preserves standalone proof outside its exact metadata block and updater bytes; only Cloudflare gets a 404', () => {
+ const file = 'gallery/artifacts/agent-tool-call.workflow.html';
+ const published = fs.readFileSync(new URL(file, output), 'utf8');
+ assert.equal(published.split(SEO_BLOCK_START).length, 2);
+ assert.equal(published.split(SEO_BLOCK_END).length, 2);
+ const start = published.indexOf(SEO_BLOCK_START), end = published.indexOf(SEO_BLOCK_END) + SEO_BLOCK_END.length;
+ assert.ok(start > published.indexOf('<head>') && end < published.indexOf('</head>'));
+ const entry = JSON.parse(fs.readFileSync(new URL('../../docs/gallery/manifest.json', import.meta.url), 'utf8')).entries.find(entry => entry.artifact === file);
+ const presentation = CASES.find(item => item.id === entry.id);
+ const block = published.slice(start, end) + '\n';
+ assert.equal(block, artifactMetadata(entry, presentation));
+ const metadataNodes = nodes(parseFragment(block)).filter(node => node.tagName);
+ assert.deepEqual(metadataNodes.map(node => node.tagName), ['link', 'meta', 'meta', 'meta', 'meta', 'meta', 'script']);
+ const structured = metadataNodes.at(-1);
+ assert.equal(attr(structured, 'type'), 'application/ld+json');
+ assert.equal(structured.attrs.length, 1);
+ assert.equal(JSON.parse(structured.childNodes.map(node => node.value || '').join(''))['@type'], 'CreativeWork');
+ assert.deepEqual(Buffer.from(stripPublishedArtifactMetadata(published)), fs.readFileSync(new URL(`../../docs/${file}`, import.meta.url)));
+ for (const asset of ['skill-updates/archify/stable.json', 'assets/site-language.js']) {
+ assert.deepEqual(fs.readFileSync(new URL(asset, output)), fs.readFileSync(new URL(`../../docs/${asset}`, import.meta.url)), asset);
}
assert.equal(fs.existsSync(new URL('404.html', output)), cloudflare);
if (cloudflare) {
diff --git a/website/test/guide-language-state.test.mjs b/website/test/guide-language-state.test.mjs
new file mode 100644
index 00000000..45b1936e
--- /dev/null
+++ b/website/test/guide-language-state.test.mjs
@@ -0,0 +1,96 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import vm from 'node:vm';
+import { guideCopy } from '../src/data/site-translations.mjs';
+
+const key = 'archify-guide-language-state.v1';
+const script = fs.readFileSync(new URL('../src/scripts/guide.js', import.meta.url), 'utf8');
+const recipes = ['architecture', 'workflow'].map(type => ({
+ id: `${type}-test`, type, signals: [], presentation: { preset: 'classic', motion: 'none' },
+ en: { title: `${type} recipe`, question: 'Question', summary: 'Summary', useWhen: 'Use', avoidWhen: 'Avoid', include: ['Evidence'], prompt: 'Prompt' },
+ zh: { title: `${type} 配方`, question: '问题', summary: '概要', useWhen: '适合', avoidWhen: '避免', include: ['证据'], prompt: '提示词' },
+}));
+function page({ language = 'en', href = 'https://archify.si/guide', target = 'https://archify.si/zh/guide', storage = new Map(), denyStorage = false }) {
+ const elements = new Map();
+ function element(id) {
+ if (!elements.has(id)) {
+ const handlers = new Map(), classes = new Set();
+ elements.set(id, {
+ value: '', textContent: '', innerHTML: '', href: target,
+ classList: { add(value) { classes.add(value); }, remove(value) { classes.delete(value); }, contains(value) { return classes.has(value); } },
+ addEventListener(event, handler) { handlers.set(event, handler); }, setAttribute() {}, focus() {}, scrollIntoView() {},
+ dispatch(event, detail) { handlers.get(event)?.(detail); },
+ });
+ }
+ return elements.get(id);
+ }
+ element('guide-data').textContent = JSON.stringify(recipes);
+ element('site-copy').textContent = JSON.stringify(guideCopy);
+ const document = {
+ documentElement: {}, getElementById: element, querySelectorAll() { return []; },
+ createElement() { return { textContent: '', get innerHTML() { return this.textContent; } }; },
+ };
+ const sessionStorage = {
+ getItem(name) { if (denyStorage) throw new Error('blocked'); return storage.get(name) || null; },
+ setItem(name, value) { if (denyStorage) throw new Error('blocked'); storage.set(name, value); },
+ removeItem(name) { if (denyStorage) throw new Error('blocked'); storage.delete(name); },
+ };
+ vm.runInNewContext(script, { document, sessionStorage, window: { location: { href } },
+ URL, ArchifySiteLanguage: { read() { return language; }, write() { return language; }, page(name, suffix) { return name + (suffix || ''); } },
+ });
+ return { element, storage };
+}
+const click = { button: 0, defaultPrevented: false, ctrlKey: false, metaKey: false, shiftKey: false, altKey: false };
+
+test('guide language navigation preserves a draft, filter and selected recipe once', () => {
+ const original = page({});
+ const draft = '展示私有系统的审批流;保留这段输入。';
+ original.element('scenario').value = draft;
+ original.element('filters').dispatch('click', { target: { closest() { return { dataset: { filter: 'workflow' } }; } } });
+ original.element('cards').dispatch('click', { target: { closest() { return { dataset: { recipe: 'workflow-test' } }; } } });
+ original.element('language').dispatch('click', click);
+ assert.equal(JSON.parse(original.storage.get(key)).scenario, draft);
+ assert.ok(!JSON.parse(original.storage.get(key)).to.includes(encodeURIComponent(draft)), 'draft never enters the navigation URL');
+ const translated = page({ language: 'zh', href: 'https://archify.si/zh/guide', target: 'https://archify.si/guide', storage: original.storage });
+ assert.equal(translated.element('scenario').value, draft);
+ assert.match(translated.element('filters').innerHTML, /class="filter active"[^>]*data-filter="workflow"/);
+ assert.match(translated.element('result').innerHTML, /<h3>workflow 配方<\/h3>/);
+ assert.equal(translated.element('result').classList.contains('visible'), true);
+ assert.equal(original.storage.has(key), false, 'restore consumes the record');
+ translated.element('language').dispatch('click', click);
+ const back = page({ storage: original.storage });
+ assert.equal(back.element('scenario').value, draft);
+ assert.match(back.element('result').innerHTML, /<h3>workflow recipe<\/h3>/);
+ assert.equal(original.storage.has(key), false);
+});
+
+test('guide discards stale, malformed and unrelated navigation state; denied storage stays usable', () => {
+ for (const state of [
+ { to: 'https://archify.si/zh/guide', at: Date.now() - 30001, scenario: 'stale' },
+ { to: 'https://archify.si/guide', at: Date.now(), scenario: 'unrelated' },
+ { to: 'https://archify.si/zh/guide', scenario: 'missing timestamp' },
+ ]) {
+ const storage = new Map([[key, JSON.stringify(state)]]);
+ const next = page({ language: 'zh', href: 'https://archify.si/zh/guide', storage });
+ assert.equal(next.element('scenario').value, '');
+ assert.equal(storage.has(key), false);
+ }
+ const blocked = page({ denyStorage: true });
+ blocked.element('scenario').value = 'still editable';
+ assert.doesNotThrow(() => blocked.element('language').dispatch('click', click));
+ assert.ok(blocked.element('cards').innerHTML.includes('architecture recipe'));
+ const normal = page({});
+ normal.element('language').dispatch('click', { ...click, ctrlKey: true });
+ assert.equal(normal.storage.has(key), false, 'modified clicks keep their native behavior');
+});
+
+test('guide draft uses the live query and hash when the language anchor is stale', () => {
+ const current = page({ href: 'https://archify.si/guide?utm_source=late#recipe-workflow', target: 'https://archify.si/zh/guide' });
+ current.element('scenario').value = 'Current draft';
+ current.element('language').dispatch('click', click);
+ const saved = JSON.parse(current.storage.get(key));
+ assert.equal(saved.to, 'https://archify.si/zh/guide?utm_source=late#recipe-workflow');
+ const translated = page({ language: 'zh', href: saved.to, storage: current.storage });
+ assert.equal(translated.element('scenario').value, 'Current draft');
+});
diff --git a/website/test/helpers/community-fixture.mjs b/website/test/helpers/community-fixture.mjs
index f0095d23..212c094f 100644
--- a/website/test/helpers/community-fixture.mjs
+++ b/website/test/helpers/community-fixture.mjs
@@ -1,4 +1,4 @@
-import { spawnSync } from 'node:child_process';
+import { spawnSync, execFileSync } from 'node:child_process';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
@@ -12,23 +12,33 @@ export function createCommunityFixture() {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-community-build-'));
const copy = relative => {
const target = path.join(root, relative);
+ let source = repoRoot;
+ for (const segment of relative.split('/')) {
+ source = path.join(source, segment);
+ if (fs.lstatSync(source).isSymbolicLink()) throw new Error(`Fixture refuses source symlink: ${relative}`);
+ }
fs.mkdirSync(path.dirname(target), { recursive: true });
- fs.cpSync(path.join(repoRoot, relative), target, { recursive: true });
+ fs.copyFileSync(source, target);
};
- // Compile the actual page, loader, validator and language script, without
- // modifying the checked-out registry or running any community package code.
- for (const relative of ['website/src', 'website/astro.config.mjs', 'website/scripts/site-target.mjs', 'website/package.json',
- 'archify/package.json', 'archify/recipes', 'scripts/site-copy.mjs',
- 'scripts/check-community-packages.mjs', 'docs/gallery/manifest.json']) copy(relative);
- const pages = path.join(root, 'website/src/pages');
- for (const file of fs.readdirSync(pages)) {
- if (file !== 'community.astro') fs.rmSync(path.join(pages, file), { recursive: true });
- }
+ // Exercise the real full-site publication hook and all locale routes while
+ // replacing only the community registry. Do not copy arbitrary untracked files.
+ const tracked = execFileSync('git', ['ls-files', '-z', '--',
+ 'website/src/', 'website/public/', 'website/astro.config.mjs', 'website/scripts/', 'website/package.json',
+ 'archify/package.json', 'archify/skill-release.json', 'archify/recipes/',
+ 'scripts/site-copy.mjs', 'scripts/check-community-packages.mjs',
+ 'docs/gallery/', 'docs/assets/', 'docs/cases/life/'], { cwd: repoRoot, encoding: 'utf8' })
+ .split('\0').filter(Boolean);
+ for (const relative of tracked) copy(relative);
fs.symlinkSync(path.join(websiteRoot, 'node_modules'), path.join(root, 'website/node_modules'), process.platform === 'win32' ? 'junction' : 'dir');
- const assets = path.join(root, 'website/.public/assets');
- fs.mkdirSync(assets, { recursive: true });
- for (const file of ['site-language.js', 'site-navigation.css', 'archify-lockup-light.svg', 'archify-mark.svg']) {
- fs.copyFileSync(path.join(repoRoot, 'docs/assets', file), path.join(assets, file));
+ const publicRoot = path.join(root, 'website/.public');
+ fs.mkdirSync(publicRoot, { recursive: true });
+ // Only the tracked public evidence/assets above enter the fixture output.
+ // Production stage-public remains unchanged and keeps its own tracked-only gate.
+ for (const relative of tracked.filter(file => file.startsWith('docs/') || file.startsWith('website/public/'))) {
+ const prefix = relative.startsWith('docs/') ? 'docs/' : 'website/public/';
+ const target = path.join(publicRoot, relative.slice(prefix.length));
+ fs.mkdirSync(path.dirname(target), { recursive: true });
+ fs.copyFileSync(path.join(root, relative), target);
}
const registry = path.join(root, 'community/packages');
fs.mkdirSync(registry, { recursive: true });
diff --git a/website/test/indexnow.test.mjs b/website/test/indexnow.test.mjs
new file mode 100644
index 00000000..da9b8409
--- /dev/null
+++ b/website/test/indexnow.test.mjs
@@ -0,0 +1,61 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import { canonicalUrl, sitePages, canonicalOrigin } from '../src/data/site-urls.mjs';
+import { CASES } from '../src/data/gallery-presentation.mjs';
+import { notifyIndexNow, parseSitemap, endpoint, key, keyLocation, sitemapLocation } from '../scripts/indexnow.mjs';
+
+const urls = [...sitePages.flatMap(page => ['en', 'zh'].map(lang => canonicalUrl(page, lang))), ...CASES.map(entry => `${canonicalOrigin}/gallery/artifacts/${entry.output.replace(/\.html$/, '')}`)];
+const xml = `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${urls.map(url => `<url><loc>${url}</loc></url>`).join('')}</urlset>`;
+function mock({ sitemap = xml, hostedKey = key, getStatus = 200, postStatus = 200 } = {}) {
+ const calls = [];
+ return { calls, fetchImpl: async (url, options) => {
+ calls.push({ url, options });
+ assert.equal(options.redirect, 'error');
+ assert.ok(options.signal instanceof AbortSignal);
+ return { status: options.method === 'POST' ? postStatus : getStatus, text: async () => url === sitemapLocation ? sitemap : hostedKey };
+ } };
+}
+
+test('public key is a root verification file and default mode only reads the deployed sitemap', async () => {
+ assert.match(key, /^[a-f0-9]{32}$/);
+ assert.equal(fs.readFileSync(new URL(`../public/${key}.txt`, import.meta.url), 'utf8'), key);
+ const service = mock();
+ const result = await notifyIndexNow(service);
+ assert.equal(result.status, 'dry-run');
+ assert.equal(service.calls.length, 1);
+ assert.equal(service.calls[0].url, sitemapLocation);
+ assert.deepEqual(result.payload, { host: 'archify.si', key, keyLocation, urlList: urls });
+});
+
+for (const status of [200, 202]) test(`HTTP ${status} confirms receipt without claiming indexing`, async () => {
+ const service = mock({ postStatus: status });
+ const result = await notifyIndexNow({ ...service, submit: true });
+ assert.equal(result.indexed, false);
+ assert.equal(result.status, status === 200 ? 'accepted' : 'queued-key-validation');
+ assert.equal(service.calls.length, 3);
+ assert.equal(service.calls[1].url, keyLocation);
+ assert.equal(service.calls[2].url, endpoint);
+ assert.deepEqual(JSON.parse(service.calls[2].options.body).urlList, urls);
+});
+
+for (const status of [400, 403, 422, 429, 500]) test(`HTTP ${status} fails once without retry`, async () => {
+ const service = mock({ postStatus: status });
+ await assert.rejects(notifyIndexNow({ ...service, submit: true }), new RegExp(`HTTP ${status}`));
+ assert.equal(service.calls.length, 3);
+});
+
+test('public preflight requires HTTP 200 and matching deployed key before POST', async () => {
+ for (const options of [{ getStatus: 404 }, { hostedKey: 'different key' }]) {
+ const service = mock(options);
+ await assert.rejects(notifyIndexNow({ ...service, submit: true }), /preflight failed|does not match/);
+ assert.ok(service.calls.every(call => call.options.method !== 'POST'));
+ }
+});
+
+test('sitemap XML parser rejects foreign, query, source, duplicate, incomplete and malformed inventories', () => {
+ assert.deepEqual(parseSitemap(xml), urls);
+ for (const sitemap of [xml.replace('https://archify.si/', 'http://archify.si/'), xml.replace('https://archify.si/', 'https://other.example/'), xml.replace(urls[0], `${urls[0]}?preview=1`), xml.replace(urls[0], `${canonicalOrigin}/gallery/manifest.json`), xml.replace(urls[0], urls[1]), xml.replace(/<url>[\s\S]*?<\/url>/, ''), xml.replace('<loc>', '<wrong>'), '<!DOCTYPE foo>' + xml]) {
+ assert.throws(() => parseSitemap(sitemap));
+ }
+});
diff --git a/website/test/local-fonts.test.mjs b/website/test/local-fonts.test.mjs
new file mode 100644
index 00000000..4f58276c
--- /dev/null
+++ b/website/test/local-fonts.test.mjs
@@ -0,0 +1,91 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { createHash } from 'node:crypto';
+import { parse } from 'parse5';
+import { stagePublic } from '../scripts/stage-public.mjs';
+
+const repo = new URL('../../', import.meta.url);
+const fonts = new URL('../public/fonts/', import.meta.url);
+const manifest = JSON.parse(fs.readFileSync(new URL('sources.json', fonts), 'utf8'));
+const css = fs.readFileSync(new URL('fonts.css', fonts), 'utf8');
+const pages = ['index', 'guide', 'start', 'gallery', 'community'];
+const sha256 = data => createHash('sha256').update(data).digest('hex');
+const nodes = node => [node, ...(node.childNodes || []).flatMap(nodes)];
+const attr = (node, name) => node.attrs?.find(item => item.name === name)?.value;
+
+test('local font declarations preserve the original families, weights and swap behavior', () => {
+ assert.doesNotMatch(css, /https?:|@import/);
+ const faces = [...css.matchAll(/@font-face\s*\{([^}]+)\}/g)].map(([, face]) => ({
+ family: /font-family:\s*'([^']+)'/.exec(face)[1],
+ style: /font-style:\s*([^;]+)/.exec(face)[1],
+ weight: Number(/font-weight:\s*(\d+)/.exec(face)[1]),
+ file: /src:\s*url\(\.\/([^)]+)\)/.exec(face)[1],
+ body: face,
+ }));
+ assert.equal(faces.length, 14);
+ assert.deepEqual(faces.map(({ family, style, weight }) => [family, style, weight]), [
+ ['Fraunces', 'italic', 400], ...[300, 400, 500].map(weight => ['Fraunces', 'normal', weight]),
+ ...[400, 450, 500, 600].map(weight => ['Inter', 'normal', weight]),
+ ...[400, 500, 600].map(weight => ['JetBrains Mono', 'normal', weight]),
+ ...[400, 500, 600].map(weight => ['Space Grotesk', 'normal', weight]),
+ ]);
+ for (const face of faces) {
+ assert.match(face.body, /font-display:\s*swap;/);
+ assert.match(face.body, /unicode-range:\s*U\+0000-00FF/);
+ assert.ok(manifest.fonts.some(font => font.file === face.file));
+ }
+ for (const page of pages) {
+ const head = fs.readFileSync(new URL(`../src/data/${page}-head.html`, import.meta.url), 'utf8');
+ assert.doesNotMatch(head, /fonts\.googleapis\.com|fonts\.gstatic\.com/);
+ assert.equal((head.match(/href="fonts\/fonts.css"/g) || []).length, 1);
+ }
+});
+
+test('tracked public staging ships authentic WOFF2 bytes, licenses and the CSS references', () => {
+ const output = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-local-fonts-'));
+ try {
+ stagePublic(fileURLToPath(repo), output);
+ assert.equal(manifest.fonts.length, 5);
+ assert.equal(manifest.licenses.length, 4);
+ assert.deepEqual(fs.readFileSync(path.join(output, 'fonts/fonts.css')), fs.readFileSync(new URL('fonts.css', fonts)));
+ for (const item of [...manifest.fonts, ...manifest.licenses]) {
+ const data = fs.readFileSync(path.join(output, 'fonts', item.file));
+ assert.equal(data.length, item.bytes, item.file);
+ assert.equal(sha256(data), item.sha256, item.file);
+ if (item.file.endsWith('.woff2')) {
+ assert.equal(data.subarray(0, 4).toString('ascii'), 'wOF2', item.file);
+ assert.equal(data.readUInt32BE(8), data.length, item.file);
+ assert.match(item.source, /^https:\/\/fonts\.gstatic\.com\/s\//);
+ } else {
+ assert.match(data.toString('utf8'), /SIL OPEN FONT LICENSE Version 1\.1/);
+ assert.ok(item.source.startsWith(`https://raw.githubusercontent.com/google/fonts/${manifest.licenseCommit}/ofl/`));
+ }
+ }
+ } finally { fs.rmSync(output, { recursive: true, force: true }); }
+});
+
+// Integration evidence is selected explicitly after the corresponding build.
+if (process.env.ARCHIFY_FONT_BUILD_CHECK === '1') test('built font links resolve to deployed bytes for both languages and the selected host', () => {
+ const cloudflare = process.env.ARCHIFY_SITE_TARGET === 'cloudflare';
+ const output = new URL(cloudflare ? '../dist-cloudflare/' : '../dist/', import.meta.url);
+ const root = cloudflare ? 'https://archify.si/' : 'https://tt-a1i.github.io/archify/';
+ for (const lang of ['en', 'zh']) for (const page of pages) {
+ const file = page === 'index' ? `${lang === 'zh' ? 'zh' : 'index'}.html` : `${lang === 'zh' ? 'zh/' : ''}${page}.html`;
+ const html = fs.readFileSync(new URL(file, output), 'utf8');
+ assert.doesNotMatch(html, /fonts\.googleapis\.com|fonts\.gstatic\.com/);
+ const all = nodes(parse(html));
+ const documentUrl = cloudflare ? new URL(file.replace(/index\.html$/, '').replace(/\.html$/, ''), root) : new URL(file, root);
+ const base = new URL(attr(all.find(node => node.tagName === 'base'), 'href'), documentUrl);
+ const links = all.filter(node => node.tagName === 'link' && attr(node, 'href') === 'fonts/fonts.css');
+ assert.equal(links.length, 1, file);
+ assert.equal(new URL(attr(links[0], 'href'), base).href, `${root}fonts/fonts.css`, file);
+ }
+ const publishedCss = fs.readFileSync(new URL('fonts/fonts.css', output), 'utf8');
+ for (const [, file] of publishedCss.matchAll(/url\(\.\/([^)]+)\)/g)) {
+ assert.deepEqual(fs.readFileSync(new URL(`fonts/${file}`, output)), fs.readFileSync(new URL(file, fonts)), file);
+ }
+});
diff --git a/website/test/localized-metadata.test.mjs b/website/test/localized-metadata.test.mjs
new file mode 100644
index 00000000..926586a3
--- /dev/null
+++ b/website/test/localized-metadata.test.mjs
@@ -0,0 +1,118 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import vm from 'node:vm';
+import { parse } from 'parse5';
+import { canonicalUrl, localPagePath, sitePages } from '../src/data/site-urls.mjs';
+import { localizeHtml } from '../src/data/localize-html.mjs';
+import { pageMetadata } from '../src/data/site-metadata.mjs';
+import { defaultProofLabels } from '../src/data/default-proof-labels.mjs';
+import { indexCopy } from '../src/data/site-translations.mjs';
+
+const nodes = node => [node, ...(node.childNodes || []).flatMap(nodes)];
+const attr = (node, name) => node?.attrs?.find(item => item.name === name)?.value;
+const text = node => node?.nodeName === '#text' ? node.value : (node?.childNodes || []).map(text).join('');
+
+test('shared static localization translates authored copy and preserves markup contracts', () => {
+ const html = '<h1 data-i18n="title">English</h1><p data-en="A &amp; B" data-zh="甲 &lt;乙&gt;">A</p><input data-i18n-placeholder="input"><a href="start.html?agent=codex&amp;input=repository#install">Start</a><a href="#section">Section</a><script src="assets/site-language.js"></script>';
+ const localized = localizeHtml(html, { page: 'guide', lang: 'zh', cloudflare: true, copy: { zh: { title: '中文 <em>标题</em>', input: '输入' } } });
+ const all = nodes(parse(localized));
+ assert.equal(text(all.find(node => node.tagName === 'h1')), '中文 标题');
+ assert.ok(all.some(node => node.tagName === 'em'));
+ assert.equal(text(all.find(node => node.tagName === 'p')), '甲 <乙>');
+ assert.equal(attr(all.find(node => node.tagName === 'input'), 'placeholder'), '输入');
+ assert.deepEqual(all.filter(node => node.tagName === 'a').map(node => attr(node, 'href')), ['zh/start?agent=codex&input=repository#install', 'zh/guide#section']);
+ assert.ok(!all.some(node => node.tagName === 'script'));
+});
+
+test('metadata points both hosts to real localized canonical pages and honest source schema', () => {
+ for (const page of sitePages) for (const lang of ['en', 'zh']) {
+ const metadata = pageMetadata(page, lang, '1.2.3');
+ assert.equal(metadata.canonical, canonicalUrl(page, lang));
+ assert.equal(metadata.schema['@graph'][1].version, '1.2.3');
+ assert.equal(metadata.schema['@graph'][1].codeRepository, 'https://github.com/tt-a1i/archify');
+ assert.match(metadata.schema['@graph'][1].license, /\/LICENSE$/);
+ assert.doesNotMatch(JSON.stringify(metadata.schema), /aggregateRating|ratingValue|downloadCount|interactionStatistic/);
+ }
+ assert.equal(canonicalUrl('index', 'zh'), 'https://archify.si/zh');
+ assert.equal(localPagePath('index', 'zh'), 'zh.html');
+ assert.equal(localPagePath('start', 'zh', true), 'zh/start');
+});
+
+function runtime({ href, base, lang = 'en', page = 'start', cloudflare = false, stored = 'zh' }) {
+ let redirected, replaced, ready;
+ const switcher = { href: '', addEventListener() {} };
+ const window = {
+ location: { href, replace(value) { redirected = value; } },
+ localStorage: { getItem() { return stored; }, setItem() {} },
+ history: { state: {}, replaceState(_state, _title, value) { replaced = value; } },
+ };
+ const document = {
+ documentElement: {}, baseURI: base,
+ getElementById() { return { textContent: JSON.stringify({ lang, page, cloudflare }) }; },
+ addEventListener(_event, callback) { ready = callback; },
+ querySelectorAll(selector) { return selector === '[data-language-switch]' ? [switcher] : []; },
+ };
+ vm.runInNewContext(fs.readFileSync(new URL('../src/scripts/site-language.js', import.meta.url), 'utf8'), { window, document, URL });
+ ready();
+ return { api: window.ArchifySiteLanguage, redirected, replaced, switcher };
+}
+
+test('URL locale wins stored preference and route switches preserve query and hash', () => {
+ for (const setup of [
+ { href: 'https://tt-a1i.github.io/archify/start.html', base: 'https://tt-a1i.github.io/archify/', expected: 'https://tt-a1i.github.io/archify/zh/start.html' },
+ { href: 'https://archify.si/start', base: 'https://archify.si/', cloudflare: true, expected: 'https://archify.si/zh/start' },
+ { href: 'file:///tmp/export/start.html', base: 'file:///tmp/export/', expected: 'file:///tmp/export/zh/start.html' },
+ ]) {
+ const suffix = '?agent=codex&type=workflow&input=repository&source=artifact&query=cache&lang=zh#install';
+ const result = runtime({ ...setup, href: setup.href + suffix });
+ assert.equal(result.api.read(), 'en', 'storage must not change the route language');
+ const next = new URL(result.redirected);
+ assert.equal(next.origin + next.pathname, new URL(setup.expected).origin + new URL(setup.expected).pathname);
+ assert.equal(next.searchParams.get('agent'), 'codex');
+ assert.equal(next.searchParams.get('type'), 'workflow');
+ assert.equal(next.searchParams.get('input'), 'repository');
+ assert.equal(next.searchParams.get('source'), 'artifact');
+ assert.equal(next.searchParams.get('query'), 'cache');
+ assert.equal(next.searchParams.has('lang'), false);
+ assert.equal(next.hash, '#install');
+ assert.equal(result.switcher.href, result.redirected);
+ }
+ const chinese = runtime({ href: 'https://archify.si/zh/start?lang=zh#install', base: 'https://archify.si/', lang: 'zh', cloudflare: true, stored: 'en' });
+ assert.equal(chinese.api.read(), 'zh');
+ assert.equal(chinese.redirected, undefined);
+ assert.equal(chinese.replaced, 'https://archify.si/zh/start#install');
+});
+
+const output = new URL(process.env.ARCHIFY_SITE_TARGET === 'cloudflare' ? '../dist-cloudflare/' : '../dist/', import.meta.url);
+test('built pages contain localized HTML and reciprocal language metadata before JavaScript', () => {
+ for (const page of sitePages) for (const lang of ['en', 'zh']) {
+ const file = lang === 'zh' ? page === 'index' ? 'zh.html' : `zh/${page}.html` : `${page}.html`;
+ const all = nodes(parse(fs.readFileSync(new URL(file, output), 'utf8')));
+ const one = (tag, name, value) => all.find(node => node.tagName === tag && attr(node, name) === value);
+ assert.equal(attr(all.find(node => node.tagName === 'html'), 'lang'), lang === 'zh' ? 'zh-Hans' : 'en', file);
+ assert.equal(attr(one('link', 'rel', 'canonical'), 'href'), canonicalUrl(page, lang), file);
+ for (const alternate of ['en', 'zh-Hans', 'x-default']) {
+ assert.equal(attr(one('link', 'hreflang', alternate), 'href'), canonicalUrl(page, alternate === 'zh-Hans' ? 'zh' : 'en'), file);
+ }
+ const title = text(all.find(node => node.tagName === 'title'));
+ assert.ok(title.startsWith('Archify'));
+ assert.equal(attr(one('meta', 'property', 'og:title'), 'content'), title, file);
+ assert.equal(attr(one('meta', 'name', 'twitter:title'), 'content'), title, file);
+ assert.equal(attr(one('meta', 'property', 'og:url'), 'content'), canonicalUrl(page, lang), file);
+ if (page === 'index') {
+ for (const [id, expected] of Object.entries({
+ 'beat-title': indexCopy[lang]['beat-0-t'], 'beat-body': indexCopy[lang]['beat-0-b'],
+ 'proof-title': defaultProofLabels.title[lang], 'proof-meta': defaultProofLabels.meta[lang],
+ })) assert.equal(text(all.find(node => attr(node, 'id') === id)), expected, `${file}: #${id} before JavaScript`);
+ const sharedLabels = all.find(node => attr(node, 'id') === 'site-proof-labels');
+ assert.deepEqual(JSON.parse(text(sharedLabels)), defaultProofLabels, file);
+ }
+ const switcher = all.find(node => attr(node, 'data-language-switch') !== undefined);
+ assert.equal(switcher.tagName, 'a', file);
+ const main = all.find(node => node.tagName === 'body');
+ const visible = nodes(main).filter(node => node.nodeName === '#text' && !['script', 'style'].includes(node.parentNode?.tagName)).map(node => node.value).join('');
+ if (lang === 'zh') assert.match(visible, /[\u4e00-\u9fff]/, file);
+ assert.ok(!all.some(node => node.tagName === 'script' && attr(node, 'src')?.endsWith('site-language.js')), file);
+ }
+});
diff --git a/website/test/migration.test.mjs b/website/test/migration.test.mjs
index e5820387..e62c0635 100644
--- a/website/test/migration.test.mjs
+++ b/website/test/migration.test.mjs
@@ -3,7 +3,9 @@ import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
-import { parse } from 'parse5';
+import { parse, parseFragment } from 'parse5';
+import { CASES } from '../src/data/gallery-presentation.mjs';
+import { artifactMetadata, SEO_BLOCK_START, SEO_BLOCK_END, stripPublishedArtifactMetadata } from '../scripts/publish-seo.mjs';
const root = fileURLToPath(new URL('../', import.meta.url));
const docs = path.resolve(root, '../docs');
@@ -23,6 +25,19 @@ function byId(node, id) {
.find(candidate => attr(candidate, 'id') === id);
}
+function semantic(node) {
+ if (node.nodeName === '#comment') return null;
+ if (node.nodeName === '#text') {
+ const text = node.value.replace(/\s+/g, ' ').trim();
+ return text || null;
+ }
+ const attrs = Object.fromEntries((node.attrs || []).map(a => [a.name, a.value]));
+ if (node.tagName === 'script' && attrs.type === 'application/json') {
+ return { tag: 'script', attrs, data: JSON.parse(node.childNodes.map(n => n.value || '').join('')) };
+ }
+ return { tag: node.tagName || node.nodeName, attrs, children: (node.childNodes || []).map(semantic).filter(Boolean) };
+}
+
for (const page of pages) {
test(`${page}: DOM, content, accessibility, scripts and styles match the migration baseline`, () => {
const old = parse(read(docs, page)), next = parse(read(dist, page));
@@ -42,8 +57,12 @@ for (const page of pages) {
assert.ok(frame, 'homepage proof iframe must remain present');
assert.ok(open, 'homepage proof link must remain present');
assert.equal(shortcuts.length, 1, 'homepage shortcut card must remain present');
- assert.equal(attr(frame, 'src'), 'gallery/artifacts/agent-tool-call.workflow.html?embed=1&theme=dark#focus=planner&reach=downstream');
- assert.equal(attr(open, 'href'), 'gallery/artifacts/agent-tool-call.workflow.html?present=1#focus=planner&reach=downstream');
+ const base = elements(next, 'base');
+ assert.equal(base.length, 1);
+ assert.equal(attr(base[0], 'href'), './');
+ const baseUri = new URL(attr(base[0], 'href'), 'https://tt-a1i.github.io/archify/index.html');
+ assert.equal(new URL(attr(frame, 'src'), baseUri).href, 'https://tt-a1i.github.io/archify/gallery/artifacts/agent-tool-call.workflow.html?embed=1&theme=dark#focus=planner&reach=downstream');
+ assert.equal(new URL(attr(open, 'href'), baseUri).href, 'https://tt-a1i.github.io/archify/gallery/artifacts/agent-tool-call.workflow.html?present=1#focus=planner&reach=downstream');
const proofScript = elements(next, 'script').find(script => (script.childNodes || []).some(child => (child.value || '').includes("hash: '#lens=backend~database'")));
assert.ok(proofScript, 'homepage proof configuration must remain present');
const scriptText = proofScript.childNodes.map(child => child.value || '').join('');
@@ -65,21 +84,80 @@ for (const page of pages) {
});
}
-test('all existing non-page public URLs retain exact file bytes', () => {
+test('homepage version labels and translations match the release identity baseline', () => {
+ const baseline = parse(read(docs, 'index.html'));
+ const generated = parse(read(dist, 'index.html'));
+ // The redesigned eyebrow separates the version chip from its channel label.
+ const version = JSON.parse(read(path.resolve(root, '../archify'), 'package.json')).version;
+ const spans = elements(generated, 'span');
+ const badge = spans.find(node => attr(node, 'data-i18n') === 'hero-badge');
+ assert.equal(semantic(badge).children.join(' '), "Stable Agent Skill · see what's new");
+ const versionChip = spans.find(node => (attr(node, 'class') || '').split(/\s+/).includes('eyebrow-tag'));
+ assert.equal(semantic(versionChip).children.join(' '), `v${version}`);
+ const copyNode = byId(generated, 'site-copy');
+ assert.ok(copyNode, 'built page must carry its shared translation dictionary');
+ const copy = JSON.parse(copyNode.childNodes.map(child => child.value || '').join(''));
+ assert.equal(copy.en['hero-badge'], "Stable Agent Skill · see what's new");
+ assert.equal(copy.zh['hero-badge'], '稳定版 Agent 技能 · 查看更新');
+ for (const key of ['footer-meta']) {
+ const labels = (tree) => [...elements(tree, 'span'), ...elements(tree, 'p')]
+ .filter(node => attr(node, 'data-i18n') === key).map(semantic);
+ assert.equal(labels(baseline).length, 1);
+ assert.deepEqual(labels(generated), labels(baseline), `${key}: initial identity`);
+ const translations = (tree) => elements(tree, 'script').flatMap(node => {
+ const source = (node.childNodes || []).map(child => child.value || '').join('');
+ return [...source.matchAll(new RegExp(`['"]${key}['"]\\s*:\\s*(['"])(.*?)\\1`, 'g'))]
+ .map(match => match[2]);
+ });
+ assert.equal(translations(baseline).length, 2, 'both built-in languages must be covered');
+ assert.deepEqual([copy.en[key], copy.zh[key]], translations(baseline), `${key}: translated identity`);
+ }
+});
+
+test('all existing non-page public URLs retain exact bytes outside the declared artifact metadata block', () => {
+ const manifest = JSON.parse(read(docs, 'gallery/manifest.json'));
+ const selected = new Map(CASES.map(presentation => {
+ const entry = manifest.entries.find(item => item.id === presentation.id);
+ assert.ok(entry, presentation.id);
+ return [entry.artifact, { entry, presentation }];
+ }));
+ function publishedBytes(file) {
+ const bytes = fs.readFileSync(path.join(dist, file));
+ const proof = selected.get(file.replaceAll(path.sep, '/'));
+ if (!proof) return bytes;
+ const html = bytes.toString('utf8');
+ assert.equal(html.split(SEO_BLOCK_START).length, 2, `${file}: one metadata start marker`);
+ assert.equal(html.split(SEO_BLOCK_END).length, 2, `${file}: one metadata end marker`);
+ const start = html.indexOf(SEO_BLOCK_START), end = html.indexOf(SEO_BLOCK_END) + SEO_BLOCK_END.length;
+ assert.ok(start > html.indexOf('<head>') && end < html.indexOf('</head>'), `${file}: metadata belongs only in head`);
+ const block = html.slice(start, end) + '\n';
+ assert.equal(block, artifactMetadata(proof.entry, proof.presentation), `${file}: exact publication metadata`);
+ const metadataNodes = (parseFragment(block).childNodes || []).filter(node => node.tagName);
+ assert.deepEqual(metadataNodes.map(node => node.tagName), ['link', 'meta', 'meta', 'meta', 'meta', 'meta', 'script']);
+ const structured = metadataNodes.at(-1);
+ assert.equal(attr(structured, 'type'), 'application/ld+json', `${file}: no executable script permitted`);
+ assert.equal(structured.attrs.length, 1);
+ const data = JSON.parse(structured.childNodes.map(node => node.value || '').join(''));
+ assert.equal(data['@type'], 'CreativeWork');
+ assert.equal(data['@context'], 'https://schema.org');
+ assert.equal(data.isBasedOn, `https://archify.si/${proof.entry.input}`);
+ return Buffer.from(stripPublishedArtifactMetadata(html), 'utf8');
+ }
function visit(dir, rel = '') {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const file = path.join(rel, entry.name);
if (entry.isDirectory()) visit(path.join(dir, entry.name), file);
- else if (!pages.includes(file)) assert.deepEqual(fs.readFileSync(path.join(dist, file)), fs.readFileSync(path.join(docs, file)), file);
+ else if (!pages.includes(file)) assert.deepEqual(publishedBytes(file), fs.readFileSync(path.join(docs, file)), file);
}
}
visit(docs);
});
test('every generated Astro asset referenced by a page exists under the Pages base', () => {
- for (const page of pages) {
+ for (const page of [...pages, 'community.html', 'zh.html', ...['gallery', 'guide', 'start', 'community'].map(page => `zh/${page}.html`)]) {
for (const match of read(dist, page).matchAll(/(?:href|src)="(\/archify\/[^"?#]+)"/g)) {
- assert.ok(fs.existsSync(path.join(dist, match[1].slice('/archify/'.length))), match[1]);
+ const relative = match[1].slice('/archify/'.length) || 'index.html';
+ assert.ok(fs.statSync(path.join(dist, relative)).isFile(), match[1]);
}
}
});
diff --git a/website/test/navigation.test.mjs b/website/test/navigation.test.mjs
index 717ce74e..56f36e54 100644
--- a/website/test/navigation.test.mjs
+++ b/website/test/navigation.test.mjs
@@ -9,17 +9,24 @@ const hasClass = (node, name) => (attr(node, 'class') || '').split(/\s+/).includ
const pages = ['index', 'gallery', 'guide', 'start', 'community'];
test('all five built pages expose one shared top navigation and the correct current page', () => {
- for (const page of pages) {
- const dom = parse(fs.readFileSync(new URL(`../dist/${page}.html`, import.meta.url), 'utf8'));
+ for (const lang of ['en', 'zh']) for (const page of pages) {
+ const file = page === 'index' ? (lang === 'zh' ? 'zh.html' : 'index.html') : `${lang === 'zh' ? 'zh/' : ''}${page}.html`;
+ const hrefFor = target => `https://tt-a1i.github.io/archify/${lang === 'zh' ? 'zh/' : ''}${target}.html`;
+ const dom = parse(fs.readFileSync(new URL(`../dist/${file}`, import.meta.url), 'utf8'));
+ const bases = nodes(dom).filter(node => node.tagName === 'base');
+ assert.equal(bases.length, 1, file);
+ assert.equal(attr(bases[0], 'href'), lang === 'zh' && page !== 'index' ? '../' : './', file);
+ const baseUri = new URL(attr(bases[0], 'href'), `https://tt-a1i.github.io/archify/${file}`);
+ const resolvedHref = node => new URL(attr(node, 'href'), baseUri).href;
const nav = nodes(dom).find(node => node.tagName === 'nav' && hasClass(node, 'site-nav'));
assert.ok(nav, page);
const links = nodes(nav).filter(node => node.tagName === 'a' && hasClass(node, 'nav-link'));
- assert.deepEqual(links.map(node => attr(node, 'href')), [
- 'guide.html', 'gallery.html', 'start.html', 'community.html', 'https://github.com/tt-a1i/archify',
+ assert.deepEqual(links.map(resolvedHref), [
+ ...['guide', 'gallery', 'start', 'community'].map(hrefFor), 'https://github.com/tt-a1i/archify',
], page);
- assert.deepEqual(links.filter(node => attr(node, 'aria-current') === 'page').map(node => attr(node, 'href')),
- page === 'index' ? [] : [`${page}.html`], page);
- const community = links.find(node => attr(node, 'href') === 'community.html');
+ assert.deepEqual(links.filter(node => attr(node, 'aria-current') === 'page').map(resolvedHref),
+ page === 'index' ? [] : [hrefFor(page)], page);
+ const community = links.find(node => resolvedHref(node) === hrefFor('community'));
if (page === 'index' || page === 'guide') {
assert.equal(attr(community, 'data-i18n'), page === 'index' ? 'nav-community' : 'navCommunity', page);
} else {
@@ -34,5 +41,9 @@ test('all five built pages expose one shared top navigation and the correct curr
test('the homepage retains its footer catalog link alongside the top entry', () => {
const dom = parse(fs.readFileSync(new URL('../dist/index.html', import.meta.url), 'utf8'));
const footer = nodes(dom).find(node => node.tagName === 'footer');
- assert.ok(nodes(footer).some(node => node.tagName === 'a' && attr(node, 'href') === 'community.html'));
+ const base = nodes(dom).filter(node => node.tagName === 'base');
+ assert.equal(base.length, 1);
+ assert.equal(attr(base[0], 'href'), './');
+ const baseUri = new URL(attr(base[0], 'href'), 'https://tt-a1i.github.io/archify/index.html');
+ assert.ok(nodes(footer).some(node => node.tagName === 'a' && new URL(attr(node, 'href'), baseUri).href === 'https://tt-a1i.github.io/archify/community.html'));
});
diff --git a/website/test/publish-seo.test.mjs b/website/test/publish-seo.test.mjs
new file mode 100644
index 00000000..84e5bb71
--- /dev/null
+++ b/website/test/publish-seo.test.mjs
@@ -0,0 +1,67 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { CASES } from '../src/data/gallery-presentation.mjs';
+import { canonicalPath, canonicalUrl, sitePages } from '../src/data/site-urls.mjs';
+import { publishSeo, selectedArtifacts, stripPublishedArtifactMetadata } from '../scripts/publish-seo.mjs';
+
+const docs = fileURLToPath(new URL('../../docs/', import.meta.url));
+function fixture() {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-search-'));
+ fs.cpSync(path.join(docs, 'gallery'), path.join(root, 'gallery'), { recursive: true });
+ for (const page of sitePages) for (const lang of ['en', 'zh']) {
+ const route = canonicalPath(page, lang).slice(1);
+ const file = !route || route.endsWith('/') ? `${route}index.html` : `${route}.html`;
+ fs.mkdirSync(path.dirname(path.join(root, file)), { recursive: true });
+ fs.writeFileSync(path.join(root, file), `<html><head><link rel="canonical" href="${canonicalUrl(page, lang)}"></head></html>`);
+ }
+ return root;
+}
+
+for (const name of ['cloudflare', 'github']) test(`${name}: published discovery metadata retains proof bytes and advertises only real canonical HTML`, () => {
+ const root = fixture();
+ try {
+ const urls = publishSeo(root, { name });
+ assert.equal(urls.length, 10 + CASES.length);
+ assert.equal(new Set(urls).size, urls.length);
+ for (const page of sitePages) for (const lang of ['en', 'zh']) assert.ok(urls.includes(canonicalUrl(page, lang)));
+ const sitemap = fs.readFileSync(path.join(root, 'sitemap.xml'), 'utf8');
+ assert.doesNotMatch(sitemap, /lastmod|priority|changefreq|\.json|\.html|tt-a1i\.github/);
+ assert.equal((sitemap.match(/<loc>/g) || []).length, urls.length);
+ for (const { entry, presentation } of selectedArtifacts(root)) {
+ const original = fs.readFileSync(path.join(docs, entry.artifact), 'utf8');
+ const published = fs.readFileSync(path.join(root, entry.artifact), 'utf8');
+ assert.equal(stripPublishedArtifactMetadata(published), original, `${entry.id}: all renderer bytes preserved`);
+ const url = `https://archify.si/${entry.artifact.replace(/\.html$/, '')}`;
+ assert.ok(published.includes(`rel="canonical" href="${url}"`));
+ const structured = JSON.parse(published.match(/<script type="application\/ld\+json">([^<]+)<\/script>/)[1]);
+ assert.equal(structured.description, presentation.descriptionEn);
+ assert.equal(structured.isBasedOn, `https://archify.si/${entry.input}`);
+ assert.deepEqual(fs.readFileSync(path.join(root, entry.input)), fs.readFileSync(path.join(docs, entry.input)));
+ }
+ const once = fs.readFileSync(path.join(root, `gallery/artifacts/${CASES[0].output}`), 'utf8');
+ publishSeo(root, { name });
+ assert.equal(fs.readFileSync(path.join(root, `gallery/artifacts/${CASES[0].output}`), 'utf8'), once, 'repeat build is idempotent');
+ assert.equal(fs.readFileSync(path.join(root, 'robots.txt'), 'utf8'), 'User-agent: *\nAllow: /\n\nSitemap: https://archify.si/sitemap.xml\n');
+ assert.equal(fs.existsSync(path.join(root, '_headers')), name === 'cloudflare');
+ if (name === 'cloudflare') assert.equal(fs.readFileSync(path.join(root, '_headers'), 'utf8'), '/*.json\n X-Robots-Tag: noindex\n');
+ } finally { fs.rmSync(root, { recursive: true, force: true }); }
+});
+
+test('publication fails closed for missing localized pages or changed proof artifacts/sources', () => {
+ const root = fixture();
+ try {
+ fs.rmSync(path.join(root, 'zh/guide.html'));
+ assert.throws(() => publishSeo(root, { name: 'cloudflare' }), /Missing indexable page/);
+ fs.writeFileSync(path.join(root, 'zh/guide.html'), '<html></html>');
+ const first = CASES[0];
+ fs.appendFileSync(path.join(root, `gallery/artifacts/${first.output}`), 'changed');
+ assert.throws(() => publishSeo(root, { name: 'cloudflare' }), /Artifact proof hash mismatch/);
+ fs.copyFileSync(path.join(docs, `gallery/artifacts/${first.output}`), path.join(root, `gallery/artifacts/${first.output}`));
+ fs.appendFileSync(path.join(root, `gallery/sources/${first.input}`), 'changed');
+ assert.throws(() => publishSeo(root, { name: 'cloudflare' }), /Source proof hash mismatch/);
+ } finally { fs.rmSync(root, { recursive: true, force: true }); }
+});
diff --git a/website/test/seo-content.test.mjs b/website/test/seo-content.test.mjs
new file mode 100644
index 00000000..cc998132
--- /dev/null
+++ b/website/test/seo-content.test.mjs
@@ -0,0 +1,82 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { parse } from 'parse5';
+import { CASES } from '../src/data/gallery-presentation.mjs';
+import { publicGuideData, SCENARIO_RECIPES, startPromptsFor } from '../../archify/recipes/scenarios.mjs';
+
+const root = process.env.ARCHIFY_SITE_ROOT || fileURLToPath(new URL(process.env.ARCHIFY_SITE_TARGET === 'cloudflare' ? '../dist-cloudflare/' : '../dist/', import.meta.url));
+const cloudflare = process.env.ARCHIFY_SITE_TARGET === 'cloudflare' || path.basename(root) === 'dist-cloudflare';
+const recipes = publicGuideData();
+const attr = (node, name) => node.attrs?.find(item => item.name === name)?.value;
+const find = (node, id) => attr(node, 'id') === id ? node : (node.childNodes || []).map(child => find(child, id)).find(Boolean);
+const text = node => node?.nodeName === '#text' ? node.value : ['script', 'style'].includes(node?.tagName) ? '' : (node?.childNodes || []).map(text).join(' ');
+const clean = value => value.replace(/\s+/g, ' ').trim();
+const read = (page, lang) => parse(fs.readFileSync(path.join(root, lang === 'zh' ? 'zh' : '', `${page}.html`), 'utf8'));
+const byClass = (node, name) => [...((attr(node, 'class') || '').split(/\s+/).includes(name) ? [node] : []), ...(node.childNodes || []).flatMap(child => byClass(child, name))];
+const byTag = (node, tag) => node.tagName === tag ? node : (node.childNodes || []).map(child => byTag(child, tag)).find(Boolean);
+function assertProofLink(page, link, lang, proof) {
+ const documentUrl = new URL(`${lang === 'zh' ? 'zh/' : ''}guide${cloudflare ? '' : '.html'}`, cloudflare ? 'https://archify.si/' : 'https://tt-a1i.github.io/archify/');
+ const base = new URL(attr(byTag(page, 'base'), 'href'), documentUrl);
+ const expectedBase = cloudflare ? '/' : '/archify/';
+ assert.equal(base.pathname, expectedBase, 'proof links resolve against the deployment base');
+ const actual = new URL(attr(link, 'href'), base);
+ assert.equal(actual.origin, documentUrl.origin);
+ assert.equal(actual.pathname, `${expectedBase}${lang === 'zh' ? 'zh/' : ''}gallery${cloudflare ? '' : '.html'}`);
+ assert.equal(actual.search, '');
+ assert.equal(actual.hash, `#proof-${proof}`);
+}
+const links = node => [...(node.tagName === 'a' ? [node] : []), ...(node.childNodes || []).flatMap(links)];
+
+for (const lang of ['en', 'zh']) {
+ test(`initial ${lang} guide HTML contains every canonical recipe and its evidence without JavaScript`, () => {
+ const page = read('guide', lang);
+ const reference = find(page, 'recipe-reference');
+ const metrics = byClass(page, 'metric').map(node => clean(text(byTag(node, 'strong'))));
+ assert.deepEqual(metrics, [String(recipes.length), String(new Set(recipes.map(recipe => recipe.type)).size), '0']);
+ assert.ok(reference, 'a persistent reference section must survive chooser rendering');
+ for (const recipe of recipes) {
+ const article = find(reference, `recipe-${recipe.id}`);
+ assert.ok(article, `stable recipe anchor ${recipe.id}`);
+ const content = clean(text(article));
+ for (const value of [recipe[lang].title, recipe[lang].question, recipe[lang].summary,
+ recipe[lang].useWhen, recipe[lang].avoidWhen, recipe[lang].prompt, ...recipe[lang].include]) {
+ assert.ok(content.includes(clean(value)), `${recipe.id}: missing initial ${lang} copy: ${value}`);
+ }
+ assert.ok(links(article).some(link => /github\.com\/tt-a1i\/archify\/blob\/(?:dev|main)\/archify\/recipes\/scenarios\.mjs$/.test(attr(link, 'href'))));
+ if (recipe.proof) {
+ const proofLink = links(article).find(link => new URL(attr(link, 'href'), 'https://example.test/').hash === `#proof-${recipe.proof}`);
+ assert.ok(proofLink, `missing proof link for ${recipe.id}`);
+ assertProofLink(page, proofLink, lang, recipe.proof);
+ }
+ }
+ });
+ test(`initial ${lang} gallery count reflects the current source inventory`, () => {
+ const page = read('gallery', lang);
+ const button = byClass(page, 'filter-button').find(node => attr(node, 'data-filter') === 'all');
+ assert.equal(clean(text(button)), lang === 'zh' ? `全部配方 / ${CASES.length}` : `All / ${CASES.length}`);
+ });
+ test(`initial ${lang} start HTML contains a usable default prompt, evidence, install, and proof`, () => {
+ const page = read('start', lang);
+ const recipe = SCENARIO_RECIPES.find(item => item.id === 'system-overview');
+ const data = JSON.parse(find(page, 'start-data').childNodes.map(node => node.value || '').join(''));
+ const count = Object.keys(data).length;
+ assert.equal(clean(text(byTag(find(page, 'type-label'), 'strong'))), lang === 'zh' ? `${count} 种类型化渲染器` : `${count} typed renderers`);
+ assert.equal(clean(text(find(page, 'recipe-question'))), clean(recipe[lang].question));
+ assert.equal(clean(text(find(page, 'recipe-prompt'))), clean(startPromptsFor(recipe, lang).descriptionPrompt));
+ for (const evidence of recipe[lang].include) assert.ok(clean(text(find(page, 'include-list'))).includes(clean(evidence)));
+ assert.match(text(find(page, 'install-command')), /npx -y skills add tt-a1i\/archify --skill archify --agent codex --global --copy --yes/);
+ assertProofLink(page, find(page, 'proof-link'), lang, recipe.proof);
+ });
+}
+test('initial homepage product facts explain identity, inputs, delivery, license and limits', () => {
+ const page = read('index', 'en');
+ const section = find(page, 'about-archify');
+ const content = clean(text(section));
+ for (const fact of ['open-source Agent Skill', 'typed JSON', 'interactive HTML', 'Mermaid', 'MIT', 'Codex', 'PNG', 'runtime system behavior', 'stable main']) assert.ok(content.includes(fact), fact);
+ const hrefs = links(section).map(link => attr(link, 'href'));
+ assert.ok(hrefs.includes('https://github.com/tt-a1i/archify/releases'));
+ assert.ok(hrefs.includes('https://github.com/tt-a1i/archify/blob/main/LICENSE'));
+});
diff --git a/website/tsconfig.json b/website/tsconfig.json
index 6b343716..40374783 100644
--- a/website/tsconfig.json
+++ b/website/tsconfig.json
@@ -11,6 +11,7 @@
],
"exclude": [
"dist",
+ "dist-cloudflare",
".public"
]
}