From 89b83e3e437256e98fad8f1c6424ea0162c58e80 Mon Sep 17 00:00:00 2001 From: Klemek Date: Mon, 27 Apr 2026 11:29:33 +0200 Subject: [PATCH] feat: updated on and better vue layout --- .github/workflows/deploy.yml | 3 ++- README.md | 2 +- articles.example/config.json | 26 ++++++++++++++------------ articles.example/style.scss | 2 +- bun.lock | 1 - package.json | 2 +- src/App.vue | 13 ++++++++++++- src/interfaces.ts | 3 ++- src/lib/articles.ts | 7 ++++++- src/lib/config.ts | 2 ++ src/router/index.ts | 10 ++++++---- src/views/AboutView.vue | 16 ++++++---------- src/views/ArticleView.vue | 35 ++++++++++++++++++----------------- src/views/HomeView.vue | 14 ++++++-------- src/views/NotFoundView.vue | 14 ++++---------- 15 files changed, 81 insertions(+), 69 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a4101c5..d338a1f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,7 +20,8 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - 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 with: name: production-files diff --git a/README.md b/README.md index d522516..41d22a9 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ bun run build - [x] config in sub repo - [x] copyright - [x] nav bar on top -- [ ] date updated +- [x] date updated - [ ] archive page - [x] about page - [ ] link to previous/next article diff --git a/articles.example/config.json b/articles.example/config.json index 58fa83f..708f19b 100644 --- a/articles.example/config.json +++ b/articles.example/config.json @@ -1,13 +1,15 @@ { - "base_url": "http://localhost/", - "title": " My Blog", - "signature": "By Me", - "lang": "en", - "custom_head": "", - "home_count": 5, - "rss_link": " RSS", - "about_link": " ABOUT", - "back_link": " Back to home", - "published_on": "Published on", - "copyright": "CC BY-NC" -} \ No newline at end of file + "base_url": "http://localhost/", + "title": " My Blog", + "signature": "By Me", + "lang": "en", + "custom_head": "", + "home_count": 5, + "rss_link": " RSS", + "about_link": " ABOUT", + "back_link": " Back to home", + "published_on": "Published on", + "updated_on": "Updated on", + "authored": "By", + "copyright": "CC BY-NC" +} diff --git a/articles.example/style.scss b/articles.example/style.scss index 73b4585..c4f818d 100644 --- a/articles.example/style.scss +++ b/articles.example/style.scss @@ -182,6 +182,6 @@ nav .nav-items { gap: 0.5em; } -.article-published { +.article-info { font-style: italic; } diff --git a/bun.lock b/bun.lock index 5074a5a..86ca87b 100644 --- a/bun.lock +++ b/bun.lock @@ -1,6 +1,5 @@ { "lockfileVersion": 1, - "configVersion": 0, "workspaces": { "": { "name": "md-blog", diff --git a/package.json b/package.json index 2354822..2fce9c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "md-blog", - "version": "1.8.1", + "version": "1.9.0", "private": true, "type": "module", "repository": "https://github.com/klemek/md-blog", diff --git a/src/App.vue b/src/App.vue index 7c2aa3f..2b9536c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,3 +1,14 @@ + + diff --git a/src/interfaces.ts b/src/interfaces.ts index dcc91ad..24145b6 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -7,7 +7,8 @@ export interface ArticleMetadata { path: string title: string date: Date - author: string + updated?: Date + author?: string thumbnail?: string draft?: boolean } diff --git a/src/lib/articles.ts b/src/lib/articles.ts index eee4a06..93d0f9c 100644 --- a/src/lib/articles.ts +++ b/src/lib/articles.ts @@ -28,7 +28,12 @@ function parseMetadata( path: pathPrefix, title: (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) ?? ''), thumbnail: (srcAttributes.thumbnail as string) ?? '', draft: draft, diff --git a/src/lib/config.ts b/src/lib/config.ts index e32bcf6..bc628aa 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -12,5 +12,7 @@ export const BACK_LINK: string = articlesConfig['back_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 BASE_URL: string = import.meta.env.BASE_URL export const PROD: boolean = import.meta.env.PROD diff --git a/src/router/index.ts b/src/router/index.ts index d5a9d9d..db326d1 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,9 +1,11 @@ -import AboutView from '@views/AboutView.vue' -import ArticleView from '@views/ArticleView.vue' -import HomeView from '@views/HomeView.vue' -import NotFoundView from '@views/NotFoundView.vue' +import { defineAsyncComponent } from 'vue' 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({ history: createWebHistory(), routes: [ diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue index 50e4a0d..167e8e5 100644 --- a/src/views/AboutView.vue +++ b/src/views/AboutView.vue @@ -1,19 +1,17 @@ diff --git a/src/views/ArticleView.vue b/src/views/ArticleView.vue index 6a842ed..d9638e1 100644 --- a/src/views/ArticleView.vue +++ b/src/views/ArticleView.vue @@ -1,15 +1,14 @@