feat(mindspace): add SEO/GEO delivery, page template catalog, and admin hooks
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
Enable optional SEO/GEO injection and discovery routes for confirmed public pages while keeping private pages noindex. Add premium page template skills, portal catalog API, template shop UI, and Baidu push gated by memind_adm config. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env node
|
||||
import assert from 'node:assert/strict';
|
||||
import express from 'express';
|
||||
import { attachPortalSeoDiscoveryRoutes } from '../server/portal-seo-discovery-routes.mjs';
|
||||
import { createMindspaceSeoDiscoveryService } from '../mindspace-seo-discovery-service.mjs';
|
||||
|
||||
const enabledConfig = {
|
||||
seoGeo: {
|
||||
enabled: true,
|
||||
seo: { enabled: true, sitemap: true, robotsTxt: true },
|
||||
geo: { enabled: true, llmsTxt: true, jsonLd: true },
|
||||
},
|
||||
};
|
||||
|
||||
const discovery = createMindspaceSeoDiscoveryService({
|
||||
query: async () => [
|
||||
[
|
||||
{
|
||||
id: 'pub-1',
|
||||
page_id: 'page-1',
|
||||
public_url: '/u/john/pages/demo',
|
||||
access_mode: 'public',
|
||||
status: 'online',
|
||||
user_confirmed_at: Date.now(),
|
||||
expires_at: null,
|
||||
updated_at: Date.now(),
|
||||
published_at: Date.now(),
|
||||
title: 'Demo',
|
||||
summary: '演示页面',
|
||||
},
|
||||
],
|
||||
],
|
||||
});
|
||||
|
||||
const app = express();
|
||||
attachPortalSeoDiscoveryRoutes(app, {
|
||||
getAuthPool: () => ({}),
|
||||
getMindSpaceConfig: async () => enabledConfig,
|
||||
getSeoDiscoveryService: () => discovery,
|
||||
resolveRequestOrigin: () => 'https://m.tkmind.cn',
|
||||
});
|
||||
|
||||
const server = app.listen(0);
|
||||
try {
|
||||
const { port } = server.address();
|
||||
const base = `http://127.0.0.1:${port}`;
|
||||
|
||||
const robots = await fetch(`${base}/robots.txt`);
|
||||
assert.equal(robots.status, 200);
|
||||
const robotsBody = await robots.text();
|
||||
assert.match(robotsBody, /Sitemap: https:\/\/m\.tkmind\.cn\/sitemap\.xml/);
|
||||
|
||||
const sitemap = await fetch(`${base}/sitemap.xml`);
|
||||
assert.equal(sitemap.status, 200);
|
||||
const sitemapBody = await sitemap.text();
|
||||
assert.match(sitemapBody, /\/u\/john\/pages\/demo/);
|
||||
|
||||
const llms = await fetch(`${base}/llms.txt`);
|
||||
assert.equal(llms.status, 200);
|
||||
const llmsBody = await llms.text();
|
||||
assert.match(llmsBody, /演示页面/);
|
||||
|
||||
console.log('verify-seo-discovery: ok');
|
||||
} finally {
|
||||
await new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve())));
|
||||
}
|
||||
Reference in New Issue
Block a user