Skip to content

Commit e7356e9

Browse files
committed
chore(website): fix links
1 parent 8378b8c commit e7356e9

8 files changed

Lines changed: 42 additions & 38 deletions

File tree

benchmark/documents/jquery.html

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
<script src="null"></script>
4545
<script>
4646
window.jQuery ||
47-
document.write(
48-
unescape(
49-
'%3Cscript src="http://api.jquery.com/jquery-wp-content/themes/jquery/js/jquery-1.9.1.min.js"%3E%3C/script%3E'
50-
)
51-
);
47+
document.write(
48+
unescape(
49+
'%3Cscript src="http://api.jquery.com/jquery-wp-content/themes/jquery/js/jquery-1.9.1.min.js"%3E%3C/script%3E'
50+
)
51+
);
5252
</script>
5353
<script src="null"></script>
5454

@@ -58,11 +58,11 @@
5858
<script src="null"></script>
5959
<style type="text/css">
6060
.tk-source-code-pro {
61-
font-family: 'source-code-pro', sans-serif;
62-
}
63-
.tk-klavika-web {
64-
font-family: 'klavika-web', sans-serif;
65-
}
61+
font-family: 'source-code-pro', sans-serif;
62+
}
63+
.tk-klavika-web {
64+
font-family: 'klavika-web', sans-serif;
65+
}
6666
</style>
6767
<link
6868
rel="stylesheet"
@@ -71,8 +71,8 @@
7171
/>
7272
<script>
7373
try {
74-
Typekit.load();
75-
} catch (_e) {}
74+
Typekit.load();
75+
} catch (_e) {}
7676
</script>
7777

7878
<link
@@ -2896,23 +2896,23 @@ <h3><span>Books</span></h3>
28962896

28972897
<script>
28982898
// biome-ignore lint/correctness/noInvalidUseBeforeDeclaration: Vendor script
2899-
var _gaq = _gaq || [];
2900-
_gaq.push(['_setAccount', 'UA-1076265-1']);
2901-
_gaq.push(['_setDomainName', 'api.jquery.com']);
2902-
_gaq.push(['_setAllowLinker', true]);
2903-
_gaq.push(['_trackPageview']);
2904-
2905-
(() => {
2906-
var ga = document.createElement('script');
2907-
ga.type = 'text/javascript';
2908-
ga.async = true;
2909-
ga.src =
2910-
`${document.location.protocol === 'https:'
2911-
? 'https://ssl'
2912-
: 'http://www'}.google-analytics.com/ga.js`;
2913-
var s = document.getElementsByTagName('script')[0];
2914-
s.parentNode.insertBefore(ga, s);
2915-
})();
2899+
var _gaq = _gaq || [];
2900+
_gaq.push(['_setAccount', 'UA-1076265-1']);
2901+
_gaq.push(['_setDomainName', 'api.jquery.com']);
2902+
_gaq.push(['_setAllowLinker', true]);
2903+
_gaq.push(['_trackPageview']);
2904+
2905+
(() => {
2906+
var ga = document.createElement('script');
2907+
ga.type = 'text/javascript';
2908+
ga.async = true;
2909+
ga.src =
2910+
`${document.location.protocol === 'https:'
2911+
? 'https://ssl'
2912+
: 'http://www'}.google-analytics.com/ga.js`;
2913+
var s = document.getElementsByTagName('script')[0];
2914+
s.parentNode.insertBefore(ga, s);
2915+
})();
29162916
</script>
29172917

29182918
<div id="cboxOverlay" style="display: none;"></div>

website/src/components/Hero.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ try {
5959
<div class="animate-fade-up mb-6 flex flex-wrap items-center justify-center gap-3 lg:justify-start">
6060
{stars && (
6161
<a
62-
href="https://github.com/cheeriojs/cheerio/stargazers"
62+
href="https://github.com/cheeriojs/cheerio"
6363
target="_blank"
6464
rel="noopener noreferrer"
6565
class="inline-flex items-center gap-1.5 rounded-full border border-slate-700/60 bg-slate-800/60 px-3 py-1.5 text-sm text-slate-300 transition-colors hover:border-slate-600 hover:text-white"

website/src/components/Sidebar.astro

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,18 @@ const apiGroups: ApiGroup[] = [];
6969
const groupedByKind = new Map<string, SidebarItem[]>();
7070
7171
for (const doc of apiDocs) {
72-
// id looks like "api/classes/Cheerio" or "api/functions/contains"
72+
// id is lowercase (e.g. "api/functions/fromurl"); use filePath for proper casing
7373
const parts = doc.id.replace(/^api\//, '').split('/');
7474
if (parts.length !== 2) continue;
75-
const [kind, name] = parts;
75+
const [kind] = parts;
76+
const name = doc.filePath
77+
.split('/')
78+
.pop()!
79+
.replace(/\.mdx?$/, '');
7680
if (!groupedByKind.has(kind)) groupedByKind.set(kind, []);
7781
groupedByKind.get(kind)!.push({
7882
label: name,
79-
href: `/docs/api/${kind}/${name}`,
83+
href: `/docs/api/${kind}/${name.toLowerCase()}`,
8084
});
8185
}
8286

website/src/layouts/DocsLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const {
2727
} = Astro.props;
2828
2929
const editUrl = sourceFile
30-
? `https://github.com/cheeriojs/cheerio/edit/main/website/src/content/docs/${sourceFile}`
30+
? `https://github.com/cheeriojs/cheerio/edit/main/website/${sourceFile}`
3131
: null;
3232
3333
const currentPath = Astro.url.pathname;

website/src/pages/docs/[slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ const h1 = headings.find((h) => h.depth === 1);
1818
const title = doc.data.title || h1?.text || doc.data.sidebar_label || doc.id;
1919
---
2020

21-
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.id}>
21+
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.filePath}>
2222
<Content />
2323
</DocsLayout>

website/src/pages/docs/advanced/[slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ const h1 = headings.find((h) => h.depth === 1);
1818
const title = doc.data.title || h1?.text || doc.data.sidebar_label || doc.id;
1919
---
2020

21-
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.id}>
21+
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.filePath}>
2222
<Content />
2323
</DocsLayout>

website/src/pages/docs/api/[...slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ const title =
2424
doc.data.title || h1?.text || doc.data.sidebar_label || 'API Documentation';
2525
---
2626

27-
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.id} wide>
27+
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.filePath} wide>
2828
<Content />
2929
</DocsLayout>

website/src/pages/docs/basics/[slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ const h1 = headings.find((h) => h.depth === 1);
1818
const title = doc.data.title || h1?.text || doc.data.sidebar_label || doc.id;
1919
---
2020

21-
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.id}>
21+
<DocsLayout title={title} description={doc.data.description} headings={headings} sourceFile={doc.filePath}>
2222
<Content />
2323
</DocsLayout>

0 commit comments

Comments
 (0)