diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..9939800
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,3 @@
+VITE_APP_TITLE=My Blog
+VITE_APP_SIGNATURE=By me
+VITE_APP_LANG=en
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index cd68f14..f5bdc70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,4 @@ __screenshots__/
# Vite
*.timestamp-*-*.mjs
+.env
\ No newline at end of file
diff --git a/bun.lock b/bun.lock
index 8a0ea9f..00f7bd9 100644
--- a/bun.lock
+++ b/bun.lock
@@ -1,5 +1,6 @@
{
"lockfileVersion": 1,
+ "configVersion": 0,
"workspaces": {
"": {
"name": "md-blog",
diff --git a/index.html b/index.html
index 0f75371..e61045e 100644
--- a/index.html
+++ b/index.html
@@ -1,10 +1,10 @@
-
+
- Blog
+ %VITE_APP_TITLE%
diff --git a/src/components/PageFooter.vue b/src/components/PageFooter.vue
new file mode 100644
index 0000000..a19f3b1
--- /dev/null
+++ b/src/components/PageFooter.vue
@@ -0,0 +1,16 @@
+
+
+
+
+ Back to home
+
+
+
+
diff --git a/src/lib/meta.ts b/src/lib/meta.ts
index a17dec5..14f5645 100644
--- a/src/lib/meta.ts
+++ b/src/lib/meta.ts
@@ -3,3 +3,5 @@ import packageJson from '@/../package.json'
export const NAME = packageJson.name
export const VERSION = packageJson.version
export const REPOSITORY = packageJson.repository
+export const TITLE = import.meta.env.VITE_APP_TITLE
+export const SIGNATURE = import.meta.env.VITE_APP_SIGNATURE
diff --git a/src/views/ArticleView.vue b/src/views/ArticleView.vue
index 306e4f9..b0aa178 100644
--- a/src/views/ArticleView.vue
+++ b/src/views/ArticleView.vue
@@ -5,10 +5,11 @@ import { loadArticle } from '@lib/articles'
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
import NotFoundView from './NotFoundView.vue'
import { dateFromParts, simpleDateFormat } from '@lib/dates'
-import { NAME, REPOSITORY, VERSION } from '@lib/meta'
+import { SIGNATURE, TITLE } from '@lib/meta'
+import PageFooter from '@components/PageFooter.vue'
const article = ref(null)
-const loading = ref(true)
+const loading = ref(true)
const route = useRoute()
async function loadPage(target: RouteLocation) {
@@ -20,13 +21,10 @@ async function loadPage(target: RouteLocation) {
target.params.day as string,
),
)
+ window.document.title = TITLE + ' — ' + (article.value?.metadata.title ?? 'Not Found')
loading.value = false
}
-function scrollTop() {
- window.scrollTo(0, 0)
-}
-
onBeforeMount(() => loadPage(route))
onBeforeRouteUpdate(loadPage)
@@ -50,17 +48,9 @@ onBeforeRouteUpdate(loadPage)
- TODO signature
+
- Go to top -
- Back to home
-
-
+
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index ecf2ca5..1dbbd66 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -2,20 +2,22 @@
import { ref, onBeforeMount } from 'vue'
import { listArticles } from '@lib/articles'
import type { ArticleMetadata } from '@interfaces'
-import { simpleDateFormat } from '@/lib/dates'
+import { simpleDateFormat } from '@lib/dates'
+import { TITLE } from '@lib/meta'
+import PageFooter from '@components/PageFooter.vue'
const articles = ref([])
onBeforeMount(async () => {
const newArticles = await listArticles()
- console.log(newArticles)
articles.value.splice(0, articles.value.length, ...newArticles)
+ window.document.title = TITLE + ' — Home'
})
- Articles
+ {{ TITLE }}
@@ -27,5 +29,6 @@ onBeforeMount(async () => {
+
diff --git a/src/views/NotFoundView.vue b/src/views/NotFoundView.vue
index 48bda74..c0717dc 100644
--- a/src/views/NotFoundView.vue
+++ b/src/views/NotFoundView.vue
@@ -1,9 +1,17 @@
-
+
Page not found
- Back to home
+
diff --git a/tsconfig.app.json b/tsconfig.app.json
index 2ad17d6..3876e79 100644
--- a/tsconfig.app.json
+++ b/tsconfig.app.json
@@ -12,7 +12,8 @@
"@lib/*": ["./src/lib/*"],
"@views/*": ["./src/views/*"],
"@interfaces": ["./src/interfaces.ts"],
- "@articles/*": ["./articles/*"]
+ "@articles/*": ["./articles/*"],
+ "@components/*": ["./src/components/*"]
},
// `vue-tsc --build` produces a .tsbuildinfo file for incremental type-checking.
diff --git a/vite.config.ts b/vite.config.ts
index e6b5bc9..1afb172 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -15,6 +15,7 @@ export default defineConfig({
'@lib': fileURLToPath(new URL('./src/lib', import.meta.url)),
'@articles': fileURLToPath(new URL('./articles', import.meta.url)),
'@interfaces': fileURLToPath(new URL('./src/interfaces.ts', import.meta.url)),
+ '@components': fileURLToPath(new URL('./src/components', import.meta.url)),
},
},
assetsInclude: [/\.\/articles\/.*(?!\.md)'/],