feat(seo): index public online pages without confirmation
Memind CI / Test, build, and release guards (push) Failing after 5m19s
Memind CI / Test, build, and release guards (push) Failing after 5m19s
Drop the user_confirmed_at gate so public, online, unexpired pages can enter sitemap/llms and receive SEO/GEO tags. Defaults now enable all discovery switches; stored all-off config is still preserved until admin saves. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,6 +9,18 @@ import {
|
||||
updateMindSpaceConfig,
|
||||
} from './mindspace-config.mjs';
|
||||
|
||||
test('defaultSeoGeoConfig enables all discovery switches', () => {
|
||||
const config = defaultSeoGeoConfig();
|
||||
assert.equal(config.enabled, true);
|
||||
assert.equal(config.seo.enabled, true);
|
||||
assert.equal(config.seo.sitemap, true);
|
||||
assert.equal(config.seo.robotsTxt, true);
|
||||
assert.equal(config.seo.baiduPush, true);
|
||||
assert.equal(config.geo.enabled, true);
|
||||
assert.equal(config.geo.jsonLd, true);
|
||||
assert.equal(config.geo.llmsTxt, true);
|
||||
});
|
||||
|
||||
test('defaultMindSpaceConfig falls back to env or 5', () => {
|
||||
assert.equal(defaultMindSpaceConfig({ MINDSPACE_FREE_PUBLIC_PAGE_LIMIT: '8' }).publicPageLimit, 8);
|
||||
assert.equal(defaultMindSpaceConfig({ MINDSPACE_FREE_PUBLIC_PAGE_LIMIT: '0' }).publicPageLimit, 5);
|
||||
@@ -24,7 +36,7 @@ test('normalizeSeoGeoConfig merges nested switches', () => {
|
||||
assert.equal(config.enabled, true);
|
||||
assert.equal(config.seo.sitemap, true);
|
||||
assert.equal(config.geo.llmsTxt, true);
|
||||
assert.equal(config.seo.baiduPush, false);
|
||||
assert.equal(config.seo.baiduPush, true);
|
||||
});
|
||||
|
||||
test('ensureMindSpaceConfig seeds the default row only when empty', async () => {
|
||||
@@ -45,6 +57,31 @@ test('ensureMindSpaceConfig seeds the default row only when empty', async () =>
|
||||
assert.deepEqual(calls[2].params.slice(0, 3), ['public_page_limit', '9', '公开页面数量上限']);
|
||||
});
|
||||
|
||||
test('loadMindSpaceConfig keeps stored all-off seoGeo instead of new defaults', async () => {
|
||||
const pool = {
|
||||
async query(sql) {
|
||||
if (sql.includes('FROM mindspace_config')) {
|
||||
return [[
|
||||
{
|
||||
key: 'seo_geo_config',
|
||||
value: JSON.stringify({
|
||||
enabled: false,
|
||||
seo: { enabled: false, canonical: true, sitemap: false, robotsTxt: false, baiduPush: false },
|
||||
geo: { enabled: false, jsonLd: false, llmsTxt: false },
|
||||
}),
|
||||
},
|
||||
]];
|
||||
}
|
||||
return [[]];
|
||||
},
|
||||
};
|
||||
|
||||
const config = await loadMindSpaceConfig(pool);
|
||||
assert.equal(config.seoGeo.enabled, false);
|
||||
assert.equal(config.seoGeo.seo.sitemap, false);
|
||||
assert.equal(config.seoGeo.geo.jsonLd, false);
|
||||
});
|
||||
|
||||
test('loadMindSpaceConfig merges stored config with fallback', async () => {
|
||||
const pool = {
|
||||
async query(sql) {
|
||||
|
||||
Reference in New Issue
Block a user