Skip to content

Commit 290af7b

Browse files
committed
fix(core): file origin is null so use href to resolve relative links
1 parent b200d9f commit 290af7b

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎apps/cli/src/ui/action-menu.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export const ActionMenu = ({
7070
setDone(true)
7171
setTimeout(() => {
7272
exit()
73+
process.stdout.write("\n")
7374
if (result.overall_score < 50) process.exit(1)
7475
}, 50)
7576
break
@@ -90,7 +91,10 @@ export const ActionMenu = ({
9091
handleAction(option.value)
9192
} else if (char === "q" || key.escape) {
9293
setDone(true)
93-
setTimeout(() => exit(), 50)
94+
setTimeout(() => {
95+
exit()
96+
process.stdout.write("\n")
97+
}, 50)
9498
}
9599
return
96100
}

‎apps/landing/src/pages/about.astro‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ const jsonLd = [
3232

3333
<h2>what changed</h2>
3434
<p>
35-
seo optimized for ranking algorithms. those algorithms read your <code>title</code>
36-
tag, your headings, your link graph, and ranked you. you could rank well
37-
while serving a single-page javascript app, because the crawler eventually
38-
rendered it.
35+
<dfn><strong>seo</strong></dfn> is a discipline that optimized for ranking
36+
algorithms. those algorithms read your <code>title</code> tag, your headings,
37+
your link graph, and ranked you. you could rank well while serving a
38+
single-page javascript app, because the crawler eventually rendered it.
3939
</p>
4040
<p>
4141
generative engines work differently. they fetch your page, parse the html,
@@ -47,11 +47,11 @@ const jsonLd = [
4747

4848
<h2>how the score works</h2>
4949
<p>
50-
<a href="/">agentimization</a> samples up to 10 pages of your site, then runs
51-
36 checks against the html, http headers, and well-known files. each check
50+
<a href="/">agentimization</a> samples up to <strong>10 pages</strong> of your site, then runs
51+
<strong>36 checks</strong> across <strong>8 categories</strong> against the html, http headers, and well-known files. each check
5252
returns one of: <strong>pass</strong>, <strong>warn</strong>, <strong>fail</strong>,
5353
<strong>skip</strong>, or <strong>info</strong>. checks are weighted by how
54-
much they affect ai-readability.
54+
much they affect ai-readability. a typical run completes in under <strong>15 seconds</strong>.
5555
</p>
5656
<p>
5757
the weighted average becomes a 0 to 100 score, mapped to a letter grade:

‎packages/core/src/checks/geo-signals.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,13 @@ const topicalAuthoritySignals: CheckDefinition = {
188188
let totalInternalLinks = 0
189189
let pagesWithGoodLinking = 0
190190

191+
// file:// urls have origin "null" so use href as the resolution base in local mode
192+
const resolveBase = ctx.mode === "local" ? ctx.baseUrl.href : ctx.baseUrl.origin
193+
191194
for (const page of pages) {
192-
const links = extractLinks(page.html, ctx.baseUrl.origin)
195+
const links = extractLinks(page.html, resolveBase)
193196
const internalLinks = ctx.mode === "local"
194-
? links.filter((l) => !l.startsWith("http://") && !l.startsWith("https://"))
197+
? links.filter((l) => l.startsWith("file:"))
195198
: links.filter((l) => {
196199
try {
197200
return new URL(l).origin === ctx.baseUrl.origin
@@ -312,7 +315,9 @@ const eeatSignals: CheckDefinition = {
312315

313316
// expertise markers
314317
const hasCredentials = /Ph\.?D|M\.?D|CPA|certified|licensed|expert|specialist/i.test(page.html)
315-
const hasAboutPage = extractLinks(page.html, ctx.baseUrl.origin).some((l) => /about|team|author/i.test(l))
318+
// file:// origin is "null" so use href in local mode
319+
const linkBase = ctx.mode === "local" ? ctx.baseUrl.href : ctx.baseUrl.origin
320+
const hasAboutPage = extractLinks(page.html, linkBase).some((l) => /about|team|author/i.test(l))
316321

317322
if (hasCredentials || hasAboutPage) withExpertise++
318323
}

0 commit comments

Comments
 (0)