diff options
| author | netop://ウィビ <paul@webb.page> | 2026-07-22 10:55:23 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-07-22 10:55:23 -0700 |
| commit | 55d8b17aeccb48194cbaea9831286b4b73ac7059 (patch) | |
| tree | 99b24d4037863802496745e6c1482e03809a2321 /src | |
| parent | b0e6f006d06553040e7f1d9db81f003607d75d2b (diff) | |
| download | blog-55d8b17aeccb48194cbaea9831286b4b73ac7059.tar.gz blog-55d8b17aeccb48194cbaea9831286b4b73ac7059.zip | |
fixes canonical links
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/create-layout.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/helper/create-layout.ts b/src/helper/create-layout.ts index f624c5f..93c71b5 100644 --- a/src/helper/create-layout.ts +++ b/src/helper/create-layout.ts @@ -14,8 +14,10 @@ import headerParser from "src/helper/parse-header.ts"; /*** EXPORT ------------------------------------------- ***/ -export default (type: "memo" | "remark", memo: string, recents: string) => { +export default (type: "memo" | "remark", memo: string, recents: string, slug?: string) => { const { abstract, /*category,*/ document, title: documentTitle } = headerParser(memo); + // https://news.ycombinator.com/item?id=48986710 + const canonicalUrl = slug ? `${url}/${slug}` : url; return ` <!DOCTYPE html> @@ -37,7 +39,7 @@ export default (type: "memo" | "remark", memo: string, recents: string) => { <meta content="${title}" property="og:site_name"/> <meta content="${documentTitle}" property="og:title"/> <meta content="website" property="og:type"/> - <meta content="${url}" property="og:url"/> + <meta content="${canonicalUrl}" property="og:url"/> <!--/ Social/App Stuff /--> <meta content="${title}" name="apple-mobile-web-app-title"/> @@ -51,7 +53,7 @@ export default (type: "memo" | "remark", memo: string, recents: string) => { <!--/ The Rest /--> <link href="https://🔥.pixels.wtf/blog/asset/apple-touch-icon.png" rel="apple-touch-icon"/> - <link href="${url}" rel="canonical"/> + <link href="${canonicalUrl}" rel="canonical"/> <link color="#111" href="https://🔥.pixels.wtf/blog/asset/favicon.svg" rel="mask-icon"/> <link href="https://social.coop/@netopwibby" rel="me"/> <link href="https://🔥.pixels.wtf/blog/asset/favicon.svg" rel="shortcut icon"/> |