Skip to content

Commit 75025ec

Browse files
committed
improve permaid links
1 parent 7ec7b3e commit 75025ec

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

.changeset/grumpy-bees-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hyperbook": minor
3+
---
4+
5+
Permaid sites are now using a small footprint approach.

packages/hyperbook/build.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,17 @@ export async function buildSingleBookPage(
8282
permaOut,
8383
file.markdown.data.permaid + ".html",
8484
);
85-
await fs.writeFile(permaFileOut, result.value);
85+
const redirectUrl = posix.join(
86+
"/",
87+
hyperbookJson.basePath || "",
88+
file.path.href || "",
89+
);
90+
const redirectHtml = `<!DOCTYPE html>
91+
<meta charset="utf-8">
92+
<meta http-equiv="refresh" content="0; url=${redirectUrl}">
93+
<link rel="canonical" href="${redirectUrl}">
94+
`;
95+
await fs.writeFile(permaFileOut, redirectHtml);
8696
}
8797
await fs.writeFile(fileOut, result.value);
8898

website/en/book/changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ If you need a new feature, open an [issue](https://github.com/openpatch/hyperboo
3838
::::
3939
-->
4040

41+
## v0.90.0
42+
43+
::::tabs
44+
45+
:::tab{title="Improved :+1:" id="improved"}
46+
47+
- Permaid files now use a lightweight HTML redirect instead of duplicating the full page content. This reduces build output size and build times while providing proper SEO via `<link rel="canonical">`.
48+
49+
:::
50+
51+
::::
52+
4153
## v0.89.3
4254

4355
::::tabs

0 commit comments

Comments
 (0)