Author SHA1 Message Date
klemek 5bda17e292 chore: release 1.11.0
Deploy / Build (push) Successful in 1m43s
Lint / Oxlint (push) Successful in 1m35s
Lint / ESLint (push) Successful in 1m49s
Lint / TypeScript (push) Successful in 2m39s
Deploy / Deploy to Stapler (push) Successful in 2m29s
2026-08-06 16:38:14 +02:00
klemek 029ced931d feat: simple tags 2026-08-06 16:37:54 +02:00
klemek 4b02934a42 chore: release 1.10.0
Lint / Oxlint (push) Successful in 7m41s
Lint / TypeScript (push) Successful in 7m41s
Deploy / Build (push) Successful in 2m42s
Lint / ESLint (push) Successful in 4m29s
Deploy / Deploy to Stapler (push) Successful in 5m3s
2026-07-24 12:33:12 +02:00
klemek a7fba1897b feat: archive link
Deploy / Deploy to Stapler (push) Has been cancelled
Deploy / Build (push) Has been cancelled
Lint / ESLint (push) Has been cancelled
Lint / TypeScript (push) Has been cancelled
Lint / Oxlint (push) Has been cancelled
2026-07-24 12:32:47 +02:00
klemek b13bb738ce fix: favicon path 2026-07-24 12:32:40 +02:00
18 changed files with 204 additions and 70 deletions
+1
View File
@@ -4,6 +4,7 @@ author: kleπek
draft: false
thumbnail: ./thumbnail.jpg
date: 2026-01-01
tags: sample
---
## Images
+4 -1
View File
@@ -5,12 +5,15 @@
"lang": "en",
"custom_head": "",
"home_count": 5,
"archive_link": "<i icon=archive></i> ARCHIVE",
"rss_link": "<i icon=rss></i> RSS",
"about_link": "<i icon=info></i> ABOUT",
"back_link": "<i icon=undo-2></i> Back to home",
"published_on": "Published on",
"updated_on": "Updated on",
"tags": "Tags:",
"authored": "By",
"copyright": "<a style=\"text-decoration:none;color:inherit;\" target=_blank href=\"https://creativecommons.org/licenses/by-nc/4.0/\">CC BY-NC</a>",
"footer": ""
"footer": "",
"favicon_ico": ""
}
+9
View File
@@ -185,3 +185,12 @@ nav .nav-items {
.article-info {
font-style: italic;
}
.article-tag {
text-decoration: underline !important;
}
.article-active-tag {
text-decoration: underline !important;
font-weight: bold;
}
+1 -1
View File
@@ -2,10 +2,10 @@
<html lang="%VITE_APP_LANG%">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="@articles/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<title>%VITE_APP_TITLE_NO_HTML%</title>
<link rel="stylesheet" type="text/css" href="/src/style.scss" />
<link rel='shortcut icon' href='/favicon.ico' />
<meta property="og:url" content="%VITE_BASE_URL%" />
<meta property="og:title" content="%VITE_APP_TITLE_NO_HTML%" />
<link rel="alternate" href="%VITE_BASE_URL%/rss.xml" type="application/rss+xml" title="RSS 2.0" />
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "md-blog",
"version": "1.9.4",
"version": "1.11.0",
"private": true,
"type": "module",
"repository": "https://git.klemek.fr/klemek/md-blog",
+10 -17
View File
@@ -37,10 +37,7 @@ function readArticleMetadata(path: string): Record<string, string> | null {
return metadata;
}
function formatArticlePage(
metadata: Record<string, string>,
baseHtml: string,
): string {
function formatArticlePage(metadata: Record<string, string>, baseHtml: string): string {
let outHtml = baseHtml;
outHtml = outHtml.replace(/<.*?property="og:url".*?>/gm, "");
outHtml = outHtml.replace(
@@ -50,10 +47,7 @@ function formatArticlePage(
const blog_title = articlesConfig.title.replace(/(<([^>]+)>)/gi, "").trim();
if (metadata.title) {
const title = metadata.title.replace(/(<([^>]+)>)/gi, "").trim();
outHtml = outHtml.replace(
/<title>.*?<\/title>/gm,
`<title>${blog_title}${title}</title>`,
);
outHtml = outHtml.replace(/<title>.*?<\/title>/gm, `<title>${blog_title}${title}</title>`);
outHtml = outHtml.replace(/<.*?property="og:title".*?>/gm, "");
outHtml = outHtml.replace(
/<\/head>/gm,
@@ -82,10 +76,7 @@ function addFeedArticle(metadata: Record<string, string>, feed: Feed) {
id: metadata.path,
link: `${articlesConfig.base_url}${metadata.path}/`,
date: new Date(Date.parse(metadata.date)),
image: metadata.thumbnail.replace(
"./",
articlesConfig.base_url + metadata.path + "/",
),
image: metadata.thumbnail.replace("./", articlesConfig.base_url + metadata.path + "/"),
});
}
}
@@ -107,7 +98,7 @@ const feed = new Feed({
id: articlesConfig.base_url,
link: articlesConfig.base_url,
language: articlesConfig.lang,
favicon: articlesConfig.base_url + "articles/favicon.ico",
favicon: articlesConfig.base_url + "/favicon.ico",
generator: "md-blog",
feedLinks: {
json: articlesConfig.base_url + "feed.json",
@@ -125,10 +116,7 @@ const feed = new Feed({
});
metadatas.forEach((metadata) => {
fs.writeFileSync(
`dist/${metadata.path}/index.html`,
formatArticlePage(metadata, indexContent),
);
fs.writeFileSync(`dist/${metadata.path}/index.html`, formatArticlePage(metadata, indexContent));
console.info(`Wrote dist/${metadata.path}/index.html`);
addFeedArticle(metadata, feed);
});
@@ -139,3 +127,8 @@ fs.writeFileSync("dist/atom.xml", feed.atom1());
console.info(`Wrote dist/atom.xml`);
fs.writeFileSync("dist/rss.xml", feed.rss2());
console.info(`Wrote dist/rss.xml`);
if (articlesConfig.favicon_ico) {
fs.copyFileSync(`articles/${articlesConfig.favicon_ico}`, "dist/favicon.ico");
console.info(`Wrote dist/favicon.ico`);
}
+26
View File
@@ -0,0 +1,26 @@
<script setup lang="ts">
import type { ArticleMetadata } from "@/interfaces";
import { simpleDateFormat } from "@lib/dates";
import { PUBLISHED_ON } from "@lib/config";
import ArticleTagList from "@/components/ArticleTagList.vue";
defineProps<{ metadata: ArticleMetadata }>();
</script>
<template>
<RouterLink :to="metadata.path" class="h-entry">
<h2 class="p-name" v-html="metadata.title"></h2>
<span class="article-info">
<span v-html="PUBLISHED_ON"></span>
&hairsp;
<time class="dt-published" :datetime="simpleDateFormat(metadata.date)">
{{ simpleDateFormat(metadata.date) }}
</time>
<template v-if="metadata.tags.length > 0">
<article-tag-list :tags="metadata.tags" />
</template>
</span>
<img v-if="metadata.thumbnail" alt="thumbnail" :src="metadata.path + metadata.thumbnail" />
</RouterLink>
</template>
+11
View File
@@ -0,0 +1,11 @@
<script setup lang="ts">
import { useRoute } from 'vue-router';
defineProps<{ tag: string }>();
const route = useRoute();
</script>
<template>
<RouterLink :class="route.query.tag === tag ? 'article-active-tag' : 'article-tag'" :to="`/?tag=${tag}`">{{ tag }}</RouterLink>
</template>
+15
View File
@@ -0,0 +1,15 @@
<script setup lang="ts">
import { TAGS } from "@lib/config";
import ArticleTag from "@/components/ArticleTag.vue";
defineProps<{ tags: string[] }>();
</script>
<template>
<span v-html="TAGS"></span>
&hairsp;
<template v-for="(tag, tagIndex) in tags" :key="tagIndex">
<template v-if="tagIndex > 0">, </template>
<article-tag :tag="tag" />
</template>
</template>
+2 -1
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { BASE_URL, TITLE, RSS_LINK, ABOUT_LINK } from '@lib/config'
import { BASE_URL, TITLE, RSS_LINK, ABOUT_LINK, ARCHIVE_LINK } from '@lib/config'
</script>
<template>
@@ -7,6 +7,7 @@ import { BASE_URL, TITLE, RSS_LINK, ABOUT_LINK } from '@lib/config'
<RouterLink to="/" class="nav-title"><span v-html="TITLE"></span></RouterLink>
<span class="nav-items">
<RouterLink to="/about/"><span v-html="ABOUT_LINK"></span></RouterLink>
<RouterLink to="/archive/"><span v-html="ARCHIVE_LINK"></span></RouterLink>
<a :href="BASE_URL + 'atom.xml'" v-html="RSS_LINK"></a>
</span>
</nav>
+10 -3
View File
@@ -5,8 +5,15 @@ import { stripHTML } from '@lib/strings'
<template>
<footer>
{{ stripHTML(TITLE) }} &copy; {{ new Date().getFullYear() }}, <span v-html="COPYRIGHT"></span>
<span v-if="FOOTER">&nbsp;| <span v-html="FOOTER"></span></span>
&nbsp;| Made with <a :href="REPOSITORY">{{ NAME }} {{ VERSION }}</a>
{{ stripHTML(TITLE) }}
&copy;
{{ new Date().getFullYear() }},
<span v-html="COPYRIGHT"></span>
<template v-if="FOOTER">
|&hairsp;
<span v-html="FOOTER"></span>
&hairsp;
</template>
| Made with <a :href="REPOSITORY">{{ NAME }} {{ VERSION }}</a>
</footer>
</template>
+1
View File
@@ -11,6 +11,7 @@ export interface ArticleMetadata {
author?: string
thumbnail?: string
draft?: boolean
tags: string[]
}
export interface Article {
+4
View File
@@ -42,6 +42,10 @@ function parseMetadata(
),
thumbnail: (srcAttributes.thumbnail as string | undefined) ?? "",
draft: draft,
tags: (srcAttributes.tags as string | undefined ?? '')
.split(',')
.map((tag) => tag.trim())
.filter((tag) => tag !== ''),
};
}
+2
View File
@@ -10,10 +10,12 @@ export const COPYRIGHT: string = articlesConfig.copyright;
export const FOOTER: string = articlesConfig.footer;
export const RSS_LINK: string = articlesConfig.rss_link;
export const BACK_LINK: string = articlesConfig.back_link;
export const ARCHIVE_LINK: string = articlesConfig.archive_link;
export const ABOUT_LINK: string = articlesConfig.about_link;
export const HOME_COUNT: number = articlesConfig.home_count;
export const PUBLISHED_ON: string = articlesConfig.published_on;
export const UPDATED_ON: string = articlesConfig.updated_on;
export const AUTHORED: string = articlesConfig.authored;
export const TAGS: string = articlesConfig.tags;
export const BASE_URL: string = import.meta.env.BASE_URL;
export const PROD: boolean = import.meta.env.PROD;
+13 -11
View File
@@ -1,17 +1,19 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@views/HomeView.vue'
import AboutView from '@views/AboutView.vue'
import ArticleView from '@views/ArticleView.vue'
import NotFoundView from '@views/NotFoundView.vue'
import { createRouter, createWebHistory } from "vue-router";
import HomeView from "@views/HomeView.vue";
import ArchiveView from "@views/ArchiveView.vue";
import AboutView from "@views/AboutView.vue";
import ArticleView from "@views/ArticleView.vue";
import NotFoundView from "@views/NotFoundView.vue";
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', component: HomeView },
{ path: '/about/', component: AboutView },
{ path: '/articles/:pathMatch(.*)/', component: ArticleView },
{ path: '/:pathMatch(.*)', component: NotFoundView },
{ path: "/", component: HomeView },
{ path: "/archive/", component: ArchiveView },
{ path: "/about/", component: AboutView },
{ path: "/articles/:pathMatch(.*)/", component: ArticleView },
{ path: "/:pathMatch(.*)", component: NotFoundView },
],
})
});
export default router
export default router;
+38
View File
@@ -0,0 +1,38 @@
<script setup lang="ts">
import { ref, onBeforeMount, onUpdated, onMounted } from 'vue'
import { listArticles, updateDynamicContent } from '@lib/articles'
import type { ArticleMetadata } from '@interfaces'
import { simpleDateFormat } from '@lib/dates'
import { PROD, TITLE } from '@lib/config'
import { stripHTML } from '@lib/strings'
const articles = ref<ArticleMetadata[]>([])
const loading = ref<boolean>(true)
onBeforeMount(async () => {
const newArticles = (await listArticles())
.filter((metadata) => (!metadata.draft || !PROD) && metadata.path)
articles.value.splice(0, articles.value.length, ...newArticles)
window.document.title = stripHTML(TITLE) + ' — Archive'
loading.value = false
await updateDynamicContent()
})
onMounted(updateDynamicContent)
onUpdated(updateDynamicContent)
</script>
<template>
<div v-if="!loading" class="home">
<ul>
<li v-for="(metadata, index) in articles" :key="index">
<div v-if="(!metadata.draft || !PROD) && metadata.path" class="article-item">
<time class="dt-published mono" :datetime="simpleDateFormat(metadata.date)">{{ simpleDateFormat(metadata.date) }}</time>
&nbsp;
<RouterLink :to="metadata.path" class="h-entry">
<span class="p-name" v-html="metadata.title"></span>
</RouterLink>
</div>
</li>
</ul>
</div>
</template>
+21 -8
View File
@@ -8,6 +8,7 @@ import { AUTHORED, PUBLISHED_ON, SIGNATURE, TITLE, UPDATED_ON } from '@lib/confi
import { stripHTML } from '@lib/strings'
import BackHomeButton from '@components/BackHomeButton.vue'
import NotFoundView from '@views/NotFoundView.vue'
import ArticleTagList from '@components/ArticleTagList.vue'
const article = ref<Article | null>(null)
const loading = ref<boolean>(true)
@@ -37,14 +38,26 @@ onUpdated(updateDynamicContent)
<div class="article-header">
<h1 class="article-title p-name" v-html="article.metadata.title"></h1>
<div class="article-info">
<span v-if="article.metadata.author"
><span v-html="AUTHORED"></span> <span class="p-author h-card" v-html="article.metadata.author"></span>
</span>
<span v-html="PUBLISHED_ON"></span> <time class="dt-published" :datetime="simpleDateFormat(article.metadata.date)">{{ simpleDateFormat(article.metadata.date) }}</time>
<span v-if="article.metadata.updated"
> <span v-html="UPDATED_ON"></span>
{{ simpleDateFormat(article.metadata.updated) }}</span
>
<template v-if="article.metadata.author">
<span v-html="AUTHORED"></span>
&hairsp;
<span class="p-author h-card" v-html="article.metadata.author"></span>
&hairsp;
</template>
<span v-html="PUBLISHED_ON"></span>
&hairsp;
<time class="dt-published" :datetime="simpleDateFormat(article.metadata.date)">
{{ simpleDateFormat(article.metadata.date) }}
</time>
<template v-if="article.metadata.updated">
&hairsp;
<span v-html="UPDATED_ON"></span>
{{ simpleDateFormat(article.metadata.updated) }}
</template>
<template v-if="article.metadata.tags.length > 0">
<article-tag-list :tags="article.metadata.tags" />
</template>
</div>
<img
v-if="article.metadata.thumbnail"
+35 -27
View File
@@ -1,42 +1,50 @@
<script setup lang="ts">
import { ref, onBeforeMount, onUpdated, onMounted } from 'vue'
import { listArticles, updateDynamicContent } from '@lib/articles'
import type { ArticleMetadata } from '@interfaces'
import { simpleDateFormat } from '@lib/dates'
import { HOME_COUNT, PROD, PUBLISHED_ON, TITLE } from '@lib/config'
import { stripHTML } from '@lib/strings'
import { ref, onBeforeMount, onUpdated, onMounted, watch } from "vue";
import { listArticles, updateDynamicContent } from "@lib/articles";
import type { ArticleMetadata } from "@interfaces";
import { HOME_COUNT, PROD, TITLE } from "@lib/config";
import { stripHTML } from "@lib/strings";
import ArticleItem from "@/components/ArticleItem.vue";
import { useRoute } from 'vue-router'
const articles = ref<ArticleMetadata[]>([])
const loading = ref<boolean>(true)
const articles = ref<ArticleMetadata[]>([]);
const filteredArticles = ref<ArticleMetadata[]>([]);
const loading = ref<boolean>(true);
const route = useRoute();
function filterArticles() {
if (route.query.tag) {
filteredArticles.value = articles.value
.filter((metadata) => metadata.tags.includes(route.query.tag as string));
} else {
filteredArticles.value = articles.value
.slice(0, HOME_COUNT);
}
}
onBeforeMount(async () => {
const newArticles = (await listArticles())
.filter((metadata) => (!metadata.draft || !PROD) && metadata.path)
.slice(0, HOME_COUNT)
articles.value.splice(0, articles.value.length, ...newArticles)
window.document.title = stripHTML(TITLE) + ' — Home'
loading.value = false
await updateDynamicContent()
articles.value.splice(0, articles.value.length, ...newArticles);
filterArticles();
window.document.title = stripHTML(TITLE) + " — Home";
loading.value = false;
await updateDynamicContent();
});
watch(() => route.query.tag, () => {
filterArticles();
})
onMounted(updateDynamicContent)
onUpdated(updateDynamicContent)
onMounted(updateDynamicContent);
onUpdated(updateDynamicContent);
</script>
<template>
<div v-if="!loading" class="home">
<template v-for="(metadata, index) in articles" :key="index">
<template v-for="(metadata, index) in filteredArticles" :key="index">
<div v-if="(!metadata.draft || !PROD) && metadata.path" class="article-item">
<RouterLink :to="metadata.path" class="h-entry">
<h2 class="p-name" v-html="metadata.title"></h2>
<span class="article-info"
><span v-html="PUBLISHED_ON"></span> <time class="dt-published" :datetime="simpleDateFormat(metadata.date)">{{ simpleDateFormat(metadata.date) }}</time></span
>
<img
v-if="metadata.thumbnail"
alt="thumbnail"
:src="metadata.path + metadata.thumbnail"
/>
</RouterLink>
<article-item :metadata="metadata" />
</div>
</template>
</div>