feat: updated on and better vue layout
This commit is contained in:
@@ -20,7 +20,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
- run: git clone ${{ vars.ARTICLES_REPOSITORY }} articles
|
- run: git clone ${{ vars.ARTICLES_REPOSITORY }} articles
|
||||||
- run: bun run build
|
- run: bun run build-only
|
||||||
|
- run: bun run post-build
|
||||||
- uses: actions/upload-artifact@v7
|
- uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: production-files
|
name: production-files
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ bun run build
|
|||||||
- [x] config in sub repo
|
- [x] config in sub repo
|
||||||
- [x] copyright
|
- [x] copyright
|
||||||
- [x] nav bar on top
|
- [x] nav bar on top
|
||||||
- [ ] date updated
|
- [x] date updated
|
||||||
- [ ] archive page
|
- [ ] archive page
|
||||||
- [x] about page
|
- [x] about page
|
||||||
- [ ] link to previous/next article
|
- [ ] link to previous/next article
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
"base_url": "http://localhost/",
|
"base_url": "http://localhost/",
|
||||||
"title": "<i icon=notepad-text></i> My Blog",
|
"title": "<i icon=notepad-text></i> My Blog",
|
||||||
"signature": "By <b>Me</b>",
|
"signature": "By <b>Me</b>",
|
||||||
"lang": "en",
|
"lang": "en",
|
||||||
"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",
|
"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>"
|
"updated_on": "Updated on",
|
||||||
|
"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>"
|
||||||
}
|
}
|
||||||
@@ -182,6 +182,6 @@ nav .nav-items {
|
|||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-published {
|
.article-info {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"configVersion": 0,
|
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"name": "md-blog",
|
"name": "md-blog",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "md-blog",
|
"name": "md-blog",
|
||||||
"version": "1.8.1",
|
"version": "1.9.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": "https://github.com/klemek/md-blog",
|
"repository": "https://github.com/klemek/md-blog",
|
||||||
|
|||||||
+12
-1
@@ -1,3 +1,14 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
|
const NavBar = defineAsyncComponent(() => import('@components/NavBar.vue'))
|
||||||
|
const PageFooter = defineAsyncComponent(() => import('@components/PageFooter.vue'))
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouterView />
|
<main>
|
||||||
|
<NavBar />
|
||||||
|
<RouterView />
|
||||||
|
<PageFooter />
|
||||||
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@ export interface ArticleMetadata {
|
|||||||
path: string
|
path: string
|
||||||
title: string
|
title: string
|
||||||
date: Date
|
date: Date
|
||||||
author: string
|
updated?: Date
|
||||||
|
author?: string
|
||||||
thumbnail?: string
|
thumbnail?: string
|
||||||
draft?: boolean
|
draft?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -28,7 +28,12 @@ function parseMetadata(
|
|||||||
path: pathPrefix,
|
path: pathPrefix,
|
||||||
title:
|
title:
|
||||||
(draft ? '[DRAFT] ' : '') + decodeURIComponent((srcAttributes.title as string) ?? 'Untitled'),
|
(draft ? '[DRAFT] ' : '') + decodeURIComponent((srcAttributes.title as string) ?? 'Untitled'),
|
||||||
date: new Date(Date.parse((srcAttributes.date as string) ?? '')),
|
date: (srcAttributes.date as string | undefined)
|
||||||
|
? new Date(Date.parse(srcAttributes.date as string))
|
||||||
|
: new Date(),
|
||||||
|
updated: (srcAttributes.updated as string | undefined)
|
||||||
|
? new Date(Date.parse(srcAttributes.updated as string))
|
||||||
|
: undefined,
|
||||||
author: decodeURIComponent((srcAttributes.author as string) ?? ''),
|
author: decodeURIComponent((srcAttributes.author as string) ?? ''),
|
||||||
thumbnail: (srcAttributes.thumbnail as string) ?? '',
|
thumbnail: (srcAttributes.thumbnail as string) ?? '',
|
||||||
draft: draft,
|
draft: draft,
|
||||||
|
|||||||
@@ -12,5 +12,7 @@ export const BACK_LINK: string = articlesConfig['back_link']
|
|||||||
export const ABOUT_LINK: string = articlesConfig['about_link']
|
export const ABOUT_LINK: string = articlesConfig['about_link']
|
||||||
export const HOME_COUNT: number = articlesConfig['home_count']
|
export const HOME_COUNT: number = articlesConfig['home_count']
|
||||||
export const PUBLISHED_ON: string = articlesConfig['published_on']
|
export const PUBLISHED_ON: string = articlesConfig['published_on']
|
||||||
|
export const UPDATED_ON: string = articlesConfig['updated_on']
|
||||||
|
export const AUTHORED: string = articlesConfig['authored']
|
||||||
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
|
||||||
|
|||||||
+6
-4
@@ -1,9 +1,11 @@
|
|||||||
import AboutView from '@views/AboutView.vue'
|
import { defineAsyncComponent } from 'vue'
|
||||||
import ArticleView from '@views/ArticleView.vue'
|
|
||||||
import HomeView from '@views/HomeView.vue'
|
|
||||||
import NotFoundView from '@views/NotFoundView.vue'
|
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
|
|
||||||
|
const AboutView = defineAsyncComponent(() => import('@views/AboutView.vue'))
|
||||||
|
const ArticleView = defineAsyncComponent(() => import('@views/ArticleView.vue'))
|
||||||
|
const HomeView = defineAsyncComponent(() => import('@views/HomeView.vue'))
|
||||||
|
const NotFoundView = defineAsyncComponent(() => import('@views/NotFoundView.vue'))
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
routes: [
|
routes: [
|
||||||
|
|||||||
+6
-10
@@ -1,19 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ABOUT_LINK, TITLE } from '@lib/config'
|
import { ABOUT_LINK, TITLE } from '@lib/config'
|
||||||
import { stripHTML } from '@lib/strings'
|
import { stripHTML } from '@lib/strings'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
|
||||||
import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
||||||
import NavBar from '@components/NavBar.vue'
|
import { updateDynamicContent } from '@lib/articles'
|
||||||
import { updateDynamicContent } from '@/lib/articles'
|
import BackHomeButton from '@components/BackHomeButton.vue'
|
||||||
import BackHomeButton from '@/components/BackHomeButton.vue'
|
|
||||||
|
|
||||||
|
const loading = ref<boolean>(true)
|
||||||
const html = ref<string>('')
|
const html = ref<string>('')
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
window.document.title = stripHTML(TITLE) + ' — ' + stripHTML(ABOUT_LINK)
|
window.document.title = stripHTML(TITLE) + ' — ' + stripHTML(ABOUT_LINK)
|
||||||
|
|
||||||
html.value = (await import('@articles/about.md')).html
|
html.value = (await import('@articles/about.md')).html
|
||||||
|
loading.value = false
|
||||||
await updateDynamicContent()
|
await updateDynamicContent()
|
||||||
})
|
})
|
||||||
onMounted(updateDynamicContent)
|
onMounted(updateDynamicContent)
|
||||||
@@ -21,10 +19,8 @@ onUpdated(updateDynamicContent)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="article">
|
<div v-if="!loading" class="article">
|
||||||
<NavBar />
|
|
||||||
<div v-html="html"></div>
|
<div v-html="html"></div>
|
||||||
<BackHomeButton />
|
<BackHomeButton />
|
||||||
<PageFooter />
|
</div>
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+18
-17
@@ -1,15 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Article } from '@interfaces'
|
import type { Article } from '@interfaces'
|
||||||
import { ref, onBeforeMount, onUpdated, onMounted } from 'vue'
|
import { ref, onBeforeMount, onUpdated, onMounted, defineAsyncComponent } from 'vue'
|
||||||
import { loadArticle, updateDynamicContent } 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 { simpleDateFormat } from '@lib/dates'
|
import { simpleDateFormat } from '@lib/dates'
|
||||||
import { PUBLISHED_ON, SIGNATURE, TITLE } from '@lib/config'
|
import { AUTHORED, PUBLISHED_ON, SIGNATURE, TITLE, UPDATED_ON } from '@lib/config'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
|
||||||
import { stripHTML } from '@lib/strings'
|
import { stripHTML } from '@lib/strings'
|
||||||
import NavBar from '@components/NavBar.vue'
|
|
||||||
import BackHomeButton from '@/components/BackHomeButton.vue'
|
const BackHomeButton = defineAsyncComponent(() => import('@components/BackHomeButton.vue'))
|
||||||
|
const NotFoundView = defineAsyncComponent(() => import('@views/NotFoundView.vue'))
|
||||||
|
|
||||||
const article = ref<Article | null>(null)
|
const article = ref<Article | null>(null)
|
||||||
const loading = ref<boolean>(true)
|
const loading = ref<boolean>(true)
|
||||||
@@ -31,19 +30,22 @@ onUpdated(updateDynamicContent)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="loading">
|
<template v-if="!loading && !article">
|
||||||
<main></main>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="!article">
|
|
||||||
<NotFoundView />
|
<NotFoundView />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<div v-if="!loading" class="article">
|
||||||
<main class="article">
|
<template v-if="!loading && article">
|
||||||
<NavBar />
|
|
||||||
<div class="article-header">
|
<div class="article-header">
|
||||||
<h1 class="article-title" v-html="article.metadata.title"></h1>
|
<h1 class="article-title" v-html="article.metadata.title"></h1>
|
||||||
<div class="article-published">
|
<div class="article-info">
|
||||||
|
<span v-if="article.metadata.author"
|
||||||
|
><span v-html="AUTHORED"></span> <span v-html="article.metadata.author"></span> —
|
||||||
|
</span>
|
||||||
<span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(article.metadata.date) }}
|
<span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(article.metadata.date) }}
|
||||||
|
<span v-if="article.metadata.updated"
|
||||||
|
>— <span v-html="UPDATED_ON"></span>
|
||||||
|
{{ simpleDateFormat(article.metadata.updated) }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
v-if="article.metadata.thumbnail"
|
v-if="article.metadata.thumbnail"
|
||||||
@@ -55,7 +57,6 @@ onUpdated(updateDynamicContent)
|
|||||||
<div class="article-text" v-html="article.html"></div>
|
<div class="article-text" v-html="article.html"></div>
|
||||||
<div class="article-signature" v-html="SIGNATURE"></div>
|
<div class="article-signature" v-html="SIGNATURE"></div>
|
||||||
<BackHomeButton />
|
<BackHomeButton />
|
||||||
<PageFooter />
|
</template>
|
||||||
</main>
|
</div>
|
||||||
</template>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ 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'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import { stripHTML } from '@lib/strings'
|
||||||
import { stripHTML } from '@/lib/strings'
|
|
||||||
import NavBar from '@components/NavBar.vue'
|
|
||||||
|
|
||||||
const articles = ref<ArticleMetadata[]>([])
|
const articles = ref<ArticleMetadata[]>([])
|
||||||
|
const loading = ref<boolean>(true)
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const newArticles = (await listArticles())
|
const newArticles = (await listArticles())
|
||||||
@@ -16,6 +15,7 @@ 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'
|
||||||
|
loading.value = false
|
||||||
await updateDynamicContent()
|
await updateDynamicContent()
|
||||||
})
|
})
|
||||||
onMounted(updateDynamicContent)
|
onMounted(updateDynamicContent)
|
||||||
@@ -23,13 +23,12 @@ onUpdated(updateDynamicContent)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="home">
|
<div v-if="!loading" class="home">
|
||||||
<NavBar />
|
|
||||||
<template v-for="(metadata, index) in articles" v-bind:key="index">
|
<template v-for="(metadata, index) in articles" v-bind:key="index">
|
||||||
<div v-if="(!metadata.draft || !PROD) && metadata.path" class="article-item">
|
<div v-if="(!metadata.draft || !PROD) && metadata.path" class="article-item">
|
||||||
<RouterLink :to="metadata.path">
|
<RouterLink :to="metadata.path">
|
||||||
<h2 v-html="metadata.title"></h2>
|
<h2 v-html="metadata.title"></h2>
|
||||||
<span class="article-published"
|
<span class="article-info"
|
||||||
><span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(metadata.date) }}</span
|
><span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(metadata.date) }}</span
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
@@ -40,6 +39,5 @@ onUpdated(updateDynamicContent)
|
|||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<PageFooter />
|
</div>
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
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 { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
|
||||||
import NavBar from '@components/NavBar.vue'
|
import { updateDynamicContent } from '@lib/articles'
|
||||||
import { updateDynamicContent } from '@/lib/articles'
|
|
||||||
|
|
||||||
|
const loading = ref<boolean>(true)
|
||||||
const html = ref<string>('')
|
const html = ref<string>('')
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
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
|
||||||
|
loading.value = false
|
||||||
await updateDynamicContent()
|
await updateDynamicContent()
|
||||||
})
|
})
|
||||||
onMounted(updateDynamicContent)
|
onMounted(updateDynamicContent)
|
||||||
@@ -20,9 +18,5 @@ onUpdated(updateDynamicContent)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="article">
|
<div v-if="!loading" class="article" v-html="html"></div>
|
||||||
<NavBar />
|
|
||||||
<div v-html="html"></div>
|
|
||||||
<PageFooter />
|
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user