aboutsummaryrefslogtreecommitdiff
path: root/src/helper/create-layout.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/helper/create-layout.ts')
-rw-r--r--src/helper/create-layout.ts8
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"/>