disable tracking on drafts
This commit is contained in:
parent
097dbb4ac8
commit
a797c4c8a2
2 changed files with 6 additions and 2 deletions
4
index.ts
4
index.ts
|
|
@ -4,6 +4,7 @@ import metadata from "./metadata.json";
|
||||||
import templateRaw from "./templates/post.html" with { type: "text" };
|
import templateRaw from "./templates/post.html" with { type: "text" };
|
||||||
import homeRaw from "./templates/home.html" with { type: "text" };
|
import homeRaw from "./templates/home.html" with { type: "text" };
|
||||||
|
|
||||||
|
const TRACKER_HEADER = `<script defer src="https://a.satr14.my.id/script.js" data-website-id="fe5155fe-e5dc-4096-a524-0c2589c859a7"></script>`;
|
||||||
const year = new Date().getFullYear().toString();
|
const year = new Date().getFullYear().toString();
|
||||||
const applyVars = (raw: unknown) => (raw as string)
|
const applyVars = (raw: unknown) => (raw as string)
|
||||||
.replaceAll("[[SITE]]", metadata.title)
|
.replaceAll("[[SITE]]", metadata.title)
|
||||||
|
|
@ -51,6 +52,9 @@ await Promise.all(posts.map(async (post) => {
|
||||||
tagFilter: true,
|
tagFilter: true,
|
||||||
});
|
});
|
||||||
const render = template
|
const render = template
|
||||||
|
.replaceAll("[[HEAD_EXTRA]]", frontmatter.draft
|
||||||
|
? "<meta name=\"robots\" content=\"noindex\">"
|
||||||
|
: TRACKER_HEADER)
|
||||||
.replaceAll("[[TITLE]]", `${metadata.title} - ${frontmatter.title}`)
|
.replaceAll("[[TITLE]]", `${metadata.title} - ${frontmatter.title}`)
|
||||||
.replaceAll("[[POST_TITLE]]", frontmatter.title)
|
.replaceAll("[[POST_TITLE]]", frontmatter.title)
|
||||||
.replaceAll("[[DATE]]", frontmatter.date.toDateString())
|
.replaceAll("[[DATE]]", frontmatter.date.toDateString())
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>[[TITLE]]</title>
|
<title>[[TITLE]]</title>
|
||||||
<link rel="stylesheet" href="../style.css">
|
<link rel="stylesheet" href="../style.css">
|
||||||
<script defer src="https://a.satr14.my.id/script.js" data-website-id="fe5155fe-e5dc-4096-a524-0c2589c859a7"></script>
|
[[HEAD_EXTRA]]
|
||||||
|
|
||||||
<meta name="description" content="[[DESC]]">
|
<meta name="description" content="[[DESC]]">
|
||||||
<meta name="author" content="[[NAME]]">
|
<meta name="author" content="[[NAME]]">
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue