Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(x-content): let an X Article body link to the pages it explains

nirholas313ae13d6d27
diff --git a/api/_lib/x-content/editorial.js b/api/_lib/x-content/editorial.js
index c4d801486..8235e2af3 100644
--- a/api/_lib/x-content/editorial.js
+++ b/api/_lib/x-content/editorial.js
@@ -86,7 +86,9 @@ function termHits(text, terms) {
return terms.map((term) => text.match(term)?.[0]).filter(Boolean);
}
-export function languageProblems(text) {
+// `body` marks an Article body: one long piece that links wherever the reader
+// needs to go, so the one-link rule (a post's reach) does not apply to it.
+export function languageProblems(text, { body = false } = {}) {
const problems = [];
const prose = withoutUrls(text);
for (const [wrong, right] of BRAND_RULES) {
@@ -114,7 +116,7 @@ export function languageProblems(text) {
problems.push({ rule: 'structure', severity: 'blocking', message: 'one-word-sentence drumbeat reads as ad copy' });
}
const links = urlsIn(text);
- if (links.length > 1) problems.push({ rule: 'links', severity: 'blocking', message: `${links.length} links; one post links one surface` });
+ if (links.length > 1 && !body) problems.push({ rule: 'links', severity: 'blocking', message: `${links.length} links; one post links one surface` });
const mentions = prose.match(/(?<![\w@])@\w{1,15}/g) || [];
if (mentions.length > 2) problems.push({ rule: 'mentions', severity: 'major', message: `${mentions.length} mentions; more than two reads as tag-baiting` });
return problems;
diff --git a/api/_lib/x-content/queue.js b/api/_lib/x-content/queue.js
index 56a0337b7..71fc05c6d 100644
--- a/api/_lib/x-content/queue.js
+++ b/api/_lib/x-content/queue.js
@@ -200,7 +200,7 @@ export function validateItem(item, root, { quality = qualityAt(root), now = Date
for (const finding of languageProblems(text)) if (finding.severity === 'blocking') problems.push(`${finding.rule}: ${finding.message}`);
}
if (articleText) {
- for (const finding of languageProblems(articleText)) if (finding.severity === 'blocking') problems.push(`article body ${finding.rule}: ${finding.message}`);
+ for (const finding of languageProblems(articleText, { body: true })) if (finding.severity === 'blocking') problems.push(`article body ${finding.rule}: ${finding.message}`);
}
for (const finding of claimProblems(item, { articleText })) if (finding.severity === 'blocking') problems.push(`${finding.rule}: ${finding.message}`);
diff --git a/api/_lib/x-content/review.js b/api/_lib/x-content/review.js
index 1e7837830..b965b6c7b 100644
--- a/api/_lib/x-content/review.js
+++ b/api/_lib/x-content/review.js
@@ -69,7 +69,7 @@ export function lintItem(item, { maximum, articleText = '' } = {}) {
for (const problem of languageProblems(item.article.title)) findings.push({ where: 'article title', ...problem });
}
if (item.kind === 'article' && articleText) {
- for (const problem of languageProblems(articleText)) findings.push({ where: 'article body', ...problem });
+ for (const problem of languageProblems(articleText, { body: true })) findings.push({ where: 'article body', ...problem });
}
for (const problem of claimProblems(item, { articleText })) findings.push({ where: 'claims', ...problem });
return findings;
diff --git a/tests/x-content.test.js b/tests/x-content.test.js
index 2a42879e2..802795fe9 100644
--- a/tests/x-content.test.js
+++ b/tests/x-content.test.js
@@ -649,6 +649,13 @@ describe('editorial', () => {
expect(claimProblems(declared).map((row) => row.message).join('\n')).toMatch(/does not appear in the copy/);
});
+ it('lets an Article body link to several pages while a post links one', async () => {
+ const { languageProblems } = await import('../api/_lib/x-content/editorial.js');
+ const text = 'Try it at three.ws/holo and read the docs at three.ws/docs/holo.';
+ expect(languageProblems(text).map((row) => row.rule)).toContain('links');
+ expect(languageProblems(text, { body: true }).map((row) => row.rule)).not.toContain('links');
+ });
+
it('reads an Article body as prose, leaving code blocks out', async () => {
const { articleProse } = await import('../api/_lib/x-content/queue.js');
const dir = sandbox();