feat: about page and better config
This commit is contained in:
@@ -23,7 +23,6 @@ bun run build
|
|||||||
- [x] nav bar on top
|
- [x] nav bar on top
|
||||||
- [ ] date updated
|
- [ ] date updated
|
||||||
- [ ] archive page
|
- [ ] archive page
|
||||||
- [ ] about page
|
- [x] about page
|
||||||
- [ ] contact/links
|
|
||||||
- [ ] link to previous/next article
|
- [ ] link to previous/next article
|
||||||
- [ ] proper docs
|
- [ ] proper docs
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"custom_head": "",
|
"custom_head": "",
|
||||||
"home_count": 5,
|
"home_count": 5,
|
||||||
"rss_link": "<i icon=rss></i> RSS",
|
"rss_link": "<i icon=rss></i> RSS",
|
||||||
|
"about_link": "<i icon=info></i> ABOUT",
|
||||||
"back_link": "<i icon=undo-2></i> Back to home",
|
"back_link": "<i icon=undo-2></i> Back to home",
|
||||||
"published_on": "Published on",
|
"published_on": "Published on",
|
||||||
"copyright": "<a style=\"text-decoration:none;color:inherit;\" target=_blank href=\"https://creativecommons.org/licenses/by-nc/4.0/\">CC BY-NC</a>"
|
"copyright": "<a style=\"text-decoration:none;color:inherit;\" target=_blank href=\"https://creativecommons.org/licenses/by-nc/4.0/\">CC BY-NC</a>"
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ nav .nav-title {
|
|||||||
|
|
||||||
nav .nav-items {
|
nav .nav-items {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-published {
|
.article-published {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "md-blog",
|
"name": "md-blog",
|
||||||
"version": "1.7.0",
|
"version": "1.8.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": "https://github.com/klemek/md-blog",
|
"repository": "https://github.com/klemek/md-blog",
|
||||||
|
|||||||
+1
-27
@@ -1,29 +1,3 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import hljs from 'highlight.js'
|
|
||||||
import { createIcons, icons } from 'lucide'
|
|
||||||
import { onMounted, onUpdated, nextTick } from 'vue'
|
|
||||||
import mermaid from 'mermaid'
|
|
||||||
|
|
||||||
async function update() {
|
|
||||||
setTimeout(async () => {
|
|
||||||
await nextTick()
|
|
||||||
hljs.highlightAll()
|
|
||||||
createIcons({
|
|
||||||
icons,
|
|
||||||
nameAttr: 'icon',
|
|
||||||
attrs: {
|
|
||||||
width: '1.1em',
|
|
||||||
height: '1.1em',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
mermaid.run()
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(update)
|
|
||||||
onUpdated(update)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouterView @vue:mounted="update" @vue:updated="update" />
|
<RouterView />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { BASE_URL, TITLE, RSS_LINK } from '@lib/config'
|
import { BASE_URL, TITLE, RSS_LINK, ABOUT_LINK } from '@lib/config'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<nav>
|
<nav>
|
||||||
<RouterLink to="/" class="nav-title"><span v-html="TITLE"></span></RouterLink>
|
<RouterLink to="/" class="nav-title"><span v-html="TITLE"></span></RouterLink>
|
||||||
<span class="nav-items">
|
<span class="nav-items">
|
||||||
|
<RouterLink to="/about/"><span v-html="ABOUT_LINK"></span></RouterLink>
|
||||||
<a :href="BASE_URL + 'atom.xml'" v-html="RSS_LINK"></a>
|
<a :href="BASE_URL + 'atom.xml'" v-html="RSS_LINK"></a>
|
||||||
</span>
|
</span>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
import type { MarkdownData, Article, ArticleMetadata } from '@interfaces'
|
import type { MarkdownData, Article, ArticleMetadata } from '@interfaces'
|
||||||
import katex from 'katex'
|
import katex from 'katex'
|
||||||
|
import { nextTick } from 'vue'
|
||||||
|
import hljs from 'highlight.js'
|
||||||
|
import mermaid from 'mermaid'
|
||||||
|
import { createIcons, icons } from 'lucide'
|
||||||
|
|
||||||
|
export async function updateDynamicContent() {
|
||||||
|
await nextTick()
|
||||||
|
hljs.highlightAll()
|
||||||
|
createIcons({
|
||||||
|
icons,
|
||||||
|
nameAttr: 'icon',
|
||||||
|
attrs: {
|
||||||
|
width: '1.1em',
|
||||||
|
height: '1.1em',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
mermaid.run()
|
||||||
|
}
|
||||||
|
|
||||||
function parseMetadata(
|
function parseMetadata(
|
||||||
srcAttributes: Record<string, unknown>,
|
srcAttributes: Record<string, unknown>,
|
||||||
|
|||||||
+9
-7
@@ -1,14 +1,16 @@
|
|||||||
import packageJson from '@/../package.json'
|
import packageJson from '@/../package.json'
|
||||||
|
import articlesConfig from '@articles/config.json'
|
||||||
|
|
||||||
export const NAME: string = packageJson.name
|
export const NAME: string = packageJson.name
|
||||||
export const VERSION: string = packageJson.version
|
export const VERSION: string = packageJson.version
|
||||||
export const REPOSITORY: string = packageJson.repository
|
export const REPOSITORY: string = packageJson.repository
|
||||||
export const TITLE: string = import.meta.env.VITE_APP_TITLE
|
export const TITLE: string = articlesConfig['title']
|
||||||
export const SIGNATURE: string = import.meta.env.VITE_APP_SIGNATURE
|
export const SIGNATURE: string = articlesConfig['signature']
|
||||||
export const COPYRIGHT: string = import.meta.env.VITE_APP_COPYRIGHT
|
export const COPYRIGHT: string = articlesConfig['copyright']
|
||||||
export const RSS_LINK: string = import.meta.env.VITE_APP_RSS_LINK
|
export const RSS_LINK: string = articlesConfig['rss_link']
|
||||||
export const BACK_LINK: string = import.meta.env.VITE_APP_BACK_LINK
|
export const BACK_LINK: string = articlesConfig['back_link']
|
||||||
export const HOME_COUNT: number = parseInt(import.meta.env.VITE_APP_HOME_COUNT)
|
export const ABOUT_LINK: string = articlesConfig['about_link']
|
||||||
export const PUBLISHED_ON: string = import.meta.env.VITE_APP_PUBLISHED_ON
|
export const HOME_COUNT: number = articlesConfig['home_count']
|
||||||
|
export const PUBLISHED_ON: string = articlesConfig['published_on']
|
||||||
export const BASE_URL: string = import.meta.env.BASE_URL
|
export const BASE_URL: string = import.meta.env.BASE_URL
|
||||||
export const PROD: boolean = import.meta.env.PROD
|
export const PROD: boolean = import.meta.env.PROD
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import AboutView from '@views/AboutView.vue'
|
||||||
import ArticleView from '@views/ArticleView.vue'
|
import ArticleView from '@views/ArticleView.vue'
|
||||||
import HomeView from '@views/HomeView.vue'
|
import HomeView from '@views/HomeView.vue'
|
||||||
import NotFoundView from '@views/NotFoundView.vue'
|
import NotFoundView from '@views/NotFoundView.vue'
|
||||||
@@ -7,6 +8,7 @@ const router = createRouter({
|
|||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
routes: [
|
routes: [
|
||||||
{ path: '/', component: HomeView },
|
{ path: '/', component: HomeView },
|
||||||
|
{ path: '/about/', component: AboutView },
|
||||||
{ path: '/articles/:pathMatch(.*)/', component: ArticleView },
|
{ path: '/articles/:pathMatch(.*)/', component: ArticleView },
|
||||||
{ path: '/:pathMatch(.*)', component: NotFoundView },
|
{ path: '/:pathMatch(.*)', component: NotFoundView },
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ABOUT_LINK, TITLE } from '@lib/config'
|
||||||
|
import { stripHTML } from '@lib/strings'
|
||||||
|
import PageFooter from '@components/PageFooter.vue'
|
||||||
|
import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
||||||
|
import NavBar from '@components/NavBar.vue'
|
||||||
|
import { updateDynamicContent } from '@/lib/articles'
|
||||||
|
|
||||||
|
const html = ref<string>('')
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
window.document.title = stripHTML(TITLE) + ' — ' + stripHTML(ABOUT_LINK)
|
||||||
|
|
||||||
|
html.value = (await import('@articles/about.md')).html
|
||||||
|
|
||||||
|
await updateDynamicContent()
|
||||||
|
})
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<main class="article">
|
||||||
|
<NavBar />
|
||||||
|
<div v-html="html"></div>
|
||||||
|
<PageFooter />
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Article } from '@interfaces'
|
import type { Article } from '@interfaces'
|
||||||
import { ref, onBeforeMount } from 'vue'
|
import { ref, onBeforeMount, onUpdated, onMounted } from 'vue'
|
||||||
import { loadArticle } from '@lib/articles'
|
import { loadArticle, updateDynamicContent } from '@lib/articles'
|
||||||
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
|
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
|
||||||
import NotFoundView from './NotFoundView.vue'
|
import NotFoundView from './NotFoundView.vue'
|
||||||
import { simpleDateFormat } from '@lib/dates'
|
import { simpleDateFormat } from '@lib/dates'
|
||||||
@@ -20,10 +20,13 @@ async function loadPage(target: RouteLocation) {
|
|||||||
window.document.title =
|
window.document.title =
|
||||||
stripHTML(TITLE) + ' — ' + stripHTML(article.value?.metadata.title ?? 'Not Found')
|
stripHTML(TITLE) + ' — ' + stripHTML(article.value?.metadata.title ?? 'Not Found')
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
await updateDynamicContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => loadPage(route))
|
onBeforeMount(() => loadPage(route))
|
||||||
onBeforeRouteUpdate(loadPage)
|
onBeforeRouteUpdate(loadPage)
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onBeforeMount } from 'vue'
|
import { ref, onBeforeMount, onUpdated, onMounted } from 'vue'
|
||||||
import { listArticles } from '@lib/articles'
|
import { listArticles, updateDynamicContent } from '@lib/articles'
|
||||||
import type { ArticleMetadata } from '@interfaces'
|
import type { ArticleMetadata } from '@interfaces'
|
||||||
import { simpleDateFormat } from '@lib/dates'
|
import { simpleDateFormat } from '@lib/dates'
|
||||||
import { HOME_COUNT, PROD, PUBLISHED_ON, TITLE } from '@lib/config'
|
import { HOME_COUNT, PROD, PUBLISHED_ON, TITLE } from '@lib/config'
|
||||||
@@ -16,7 +16,10 @@ onBeforeMount(async () => {
|
|||||||
.slice(0, HOME_COUNT)
|
.slice(0, HOME_COUNT)
|
||||||
articles.value.splice(0, articles.value.length, ...newArticles)
|
articles.value.splice(0, articles.value.length, ...newArticles)
|
||||||
window.document.title = stripHTML(TITLE) + ' — Home'
|
window.document.title = stripHTML(TITLE) + ' — Home'
|
||||||
|
await updateDynamicContent()
|
||||||
})
|
})
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
import { TITLE } from '@lib/config'
|
import { TITLE } from '@lib/config'
|
||||||
import { stripHTML } from '@lib/strings'
|
import { stripHTML } from '@lib/strings'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import PageFooter from '@components/PageFooter.vue'
|
||||||
import { onBeforeMount, ref } from 'vue'
|
import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
||||||
import NavBar from '@components/NavBar.vue'
|
import NavBar from '@components/NavBar.vue'
|
||||||
|
import { updateDynamicContent } from '@/lib/articles'
|
||||||
|
|
||||||
const html = ref<string>('')
|
const html = ref<string>('')
|
||||||
|
|
||||||
@@ -11,7 +12,11 @@ onBeforeMount(async () => {
|
|||||||
window.document.title = stripHTML(TITLE)
|
window.document.title = stripHTML(TITLE)
|
||||||
|
|
||||||
html.value = (await import('@articles/not_found.md')).html
|
html.value = (await import('@articles/not_found.md')).html
|
||||||
|
|
||||||
|
await updateDynamicContent()
|
||||||
})
|
})
|
||||||
|
onMounted(updateDynamicContent)
|
||||||
|
onUpdated(updateDynamicContent)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -14,13 +14,7 @@ export default ({ mode }: { mode: string }) => {
|
|||||||
process.env.VITE_APP_TITLE = articlesConfig['title']
|
process.env.VITE_APP_TITLE = articlesConfig['title']
|
||||||
process.env.VITE_APP_TITLE_NO_HTML = articlesConfig['title'].replace(/(<([^>]+)>)/gi, '').trim()
|
process.env.VITE_APP_TITLE_NO_HTML = articlesConfig['title'].replace(/(<([^>]+)>)/gi, '').trim()
|
||||||
process.env.VITE_APP_LANG = articlesConfig['lang']
|
process.env.VITE_APP_LANG = articlesConfig['lang']
|
||||||
process.env.VITE_APP_SIGNATURE = articlesConfig['signature']
|
|
||||||
process.env.VITE_CUSTOM_HEAD = articlesConfig['custom_head']
|
process.env.VITE_CUSTOM_HEAD = articlesConfig['custom_head']
|
||||||
process.env.VITE_APP_COPYRIGHT = articlesConfig['copyright']
|
|
||||||
process.env.VITE_APP_RSS_LINK = articlesConfig['rss_link']
|
|
||||||
process.env.VITE_APP_BACK_LINK = articlesConfig['back_link']
|
|
||||||
process.env.VITE_APP_HOME_COUNT = articlesConfig['home_count'].toString()
|
|
||||||
process.env.VITE_APP_PUBLISHED_ON = articlesConfig['published_on']
|
|
||||||
|
|
||||||
return defineConfig({
|
return defineConfig({
|
||||||
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
|
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
|
||||||
|
|||||||
Reference in New Issue
Block a user