Compare commits
2 commits
9a80850230
...
2f5bf48b42
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f5bf48b42 | |||
| 55e67d1e27 |
7 changed files with 29 additions and 5 deletions
|
|
@ -58,7 +58,7 @@ const isReleased = (post) => {
|
|||
}
|
||||
|
||||
const markdownItHashtag = (md) => {
|
||||
const hashtagRegex = /^#([a-zA-Z][a-zA-Z0-9_\\\\/]*)(?![a-zA-Z0-9_-])/;
|
||||
const hashtagRegex = /^#([a-zA-Z][a-zA-Z0-9_\\\\/\-]*)(?![a-zA-Z0-9_-])/;
|
||||
|
||||
const HASH_CODE = '#'.charCodeAt(0);
|
||||
const SPACE_CODE = ' '.charCodeAt(0);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ description: Welcome to my website! I write about tech, politics, food, and hobb
|
|||
<li>
|
||||
<a href="{{ post.url }}" class="post-card">
|
||||
<h2>{{ post.data.title }}</h2>
|
||||
<time datetime="{{ post.data.createdAt | dateTimeFormat }}">{{ post.data.createdAt | dateTimeFormat }}</time>
|
||||
<time class="localizable-time" datetime="{{ post.data.createdAt | isoDateTime }}">{{ post.data.createdAt | dateTimeFormat }}</time>
|
||||
{% if post.data.description %}
|
||||
<p>{{ post.data.description }}</p>
|
||||
{% endif %}
|
||||
|
|
@ -54,6 +54,7 @@ description: Welcome to my website! I write about tech, politics, food, and hobb
|
|||
<li>
|
||||
<a href="/recipe/{{ recipe.slug }}/" class="post-card">
|
||||
<h2>{{ recipe.data.newest.data.title }}</h2>
|
||||
<time class="localizable-time" datetime="{{ recipe.data.newest.data.createdAt | isoDateTime }}">{{ recipe.data.newest.data.createdAt | dateTimeFormat }}</time>
|
||||
{% if recipe.data.newest.data.description %}
|
||||
<p>{{ recipe.data.newest.data.description }}</p>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ permalink: /posts/
|
|||
<li>
|
||||
<a href="{{ post.url }}" class="post-card">
|
||||
<h2>{{ post.data.title }}</h2>
|
||||
<time datetime="{{ post.data.createdAt | dateTimeFormat }}">{{ post.data.createdAt | dateTimeFormat }}</time>
|
||||
<time class="localizable-time" datetime="{{ post.data.createdAt | isoDateTime }}">{{ post.data.createdAt | dateTimeFormat }}</time>
|
||||
{% if post.data.description %}
|
||||
<p>{{ post.data.description }}</p>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -921,3 +921,5 @@ You can also use web tools that you can give a URL and it will clean it for you:
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
#privacy #tracking #surveillance #digital-rights #activism #data-collection #security
|
||||
|
|
@ -21,6 +21,7 @@ permalink: /recipes/
|
|||
<li>
|
||||
<a href="/recipe/{{ slug }}/" class="post-card">
|
||||
<h2>{{ recipeData.newest.data.title }}</h2>
|
||||
<time class="localizable-time" datetime="{{ recipeData.newest.data.createdAt | isoDateTime }}">{{ recipeData.newest.data.createdAt | dateTimeFormat }}</time>
|
||||
{% if recipeData.newest.data.description %}
|
||||
<p>{{ recipeData.newest.data.description }}</p>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const fs = require('fs')
|
||||
const path = require("path");
|
||||
const { execSync } = require("child_process");
|
||||
const { DateTime } = require("luxon");
|
||||
|
||||
const getSlugFromPath = (filePath) => {
|
||||
// Normalize the path - remove leading ./ if present
|
||||
|
|
@ -62,6 +63,21 @@ const getFileCreatedTime = (filePath) => {
|
|||
}
|
||||
}
|
||||
|
||||
const getFileCreatedDateTime = (filePath) => {
|
||||
const gitTime = getGitCreatedTime(filePath);
|
||||
if (gitTime) {
|
||||
return DateTime.fromMillis(gitTime, { zone: 'utc' });
|
||||
}
|
||||
|
||||
try {
|
||||
const stats = fs.statSync(filePath);
|
||||
const time = stats.birthtime ?? stats.mtime;
|
||||
return DateTime.fromJSDate(time, { zone: 'utc' });
|
||||
} catch (e) {
|
||||
return DateTime.utc();
|
||||
}
|
||||
}
|
||||
|
||||
const getVersion = (filePath) => {
|
||||
const dirName = path.dirname(filePath)
|
||||
|
||||
|
|
@ -145,6 +161,9 @@ module.exports = {
|
|||
isDraft: (data) => {
|
||||
return data.draft === true;
|
||||
},
|
||||
createdAt: (data) => {
|
||||
return getFileCreatedDateTime(data.page.inputPath);
|
||||
},
|
||||
permalink: (data) => {
|
||||
const slug = getSlugFromPath(data.page.inputPath);
|
||||
const version = getVersion(data.page.inputPath);
|
||||
|
|
|
|||
3
tags.njk
3
tags.njk
|
|
@ -19,7 +19,7 @@ layout: base.njk
|
|||
<li>
|
||||
<a href="{{ post.url }}" class="post-card">
|
||||
<h2>{{ post.data.title }}</h2>
|
||||
<time datetime="{{ post.date | dateTimeFormat }}">{{ post.date | dateTimeFormat }}</time>
|
||||
<time class="localizable-time" datetime="{{ post.data.createdAt | isoDateTime }}">{{ post.data.createdAt | dateTimeFormat }}</time>
|
||||
{% if post.data.description %}
|
||||
<p>{{ post.data.description }}</p>
|
||||
{% endif %}
|
||||
|
|
@ -36,6 +36,7 @@ layout: base.njk
|
|||
<li>
|
||||
<a href="/recipe/{{ recipe.data.recipeSlug }}/" class="post-card">
|
||||
<h2>{{ recipe.data.title }}</h2>
|
||||
<time class="localizable-time" datetime="{{ recipe.data.createdAt | isoDateTime }}">{{ recipe.data.createdAt | dateTimeFormat }}</time>
|
||||
{% if recipe.data.description %}
|
||||
<p>{{ recipe.data.description }}</p>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue