diff --git a/src/App.vue b/src/App.vue index a48b546..3ca5aef 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,4 +30,8 @@ import TheFooter from './components/TheFooter.vue' border-width: 0 5px; border-color: #d54e53; } + +main { + padding-top: 1em; +} diff --git a/src/components/TheHeader.vue b/src/components/TheHeader.vue index 3a6ac92..9c226b6 100644 --- a/src/components/TheHeader.vue +++ b/src/components/TheHeader.vue @@ -1,3 +1,12 @@ + + @@ -6,6 +15,14 @@ + + + + + + + + diff --git a/src/components/ThePost.vue b/src/components/ThePost.vue index ab34974..093a76a 100644 --- a/src/components/ThePost.vue +++ b/src/components/ThePost.vue @@ -7,14 +7,13 @@ const props = defineProps<{ - - post content goes here - + {{ title }} + - Originally authored: {{ props.date.toLocaleDateString("en-US") }} - + Originally authored: {{ props.date.toLocaleDateString("sv-SE") }} + diff --git a/src/components/ThePosts.vue b/src/components/ThePosts.vue index a274727..b491c01 100644 --- a/src/components/ThePosts.vue +++ b/src/components/ThePosts.vue @@ -1,15 +1,32 @@ - + + + {{ post.date.toLocaleDateString("sv-SE") }} + + + diff --git a/src/main.scss b/src/main.scss index cb0b0ab..312320c 100644 --- a/src/main.scss +++ b/src/main.scss @@ -36,3 +36,9 @@ a:visited { a:hover { color: #70c0b1; } + +hr { + color: #808080; + border: 0; + border-bottom: 1px dashed; +} diff --git a/src/posts/index.ts b/src/posts/index.ts index a4dbfe7..f7233e5 100644 --- a/src/posts/index.ts +++ b/src/posts/index.ts @@ -1,5 +1,6 @@ -// @ts-nocheck import type { ComponentOptions } from 'vue' +import { h, defineComponent } from 'vue' +import ThePost from '../components/ThePost.vue' export type Post = { title : string, @@ -7,6 +8,7 @@ export type Post = { slug : string, path : string, url : string, + excerpt : string, component : ComponentOptions, } @@ -14,15 +16,38 @@ const imports = await Promise.all( Object.values(import.meta.glob('./*.md')).map((m) => m()) ) +// @ts-ignore const posts : Post[] = imports.map((post) => { + // @ts-ignore const slug = post.default.__name const path = "/posts/" + slug const url = path + ".html" + // @ts-ignore + const date = new Date(post.date) + // @ts-ignore + const title = post.title return { - title: post.title, - date: new Date(post.date), - slug, path, url, - component: post.default + // @ts-ignore + excerpt: post.excerpt, + title, date, slug, path, url, + component: defineComponent( + (props) => { + return () => { + return h( + ThePost, + { + date: date, + title: title + }, + { + // @ts-ignore + default: post.default.render + } + ) + } + }, + { props: {} } + ) } }) diff --git a/vite.config.ts b/vite.config.ts index 24c3631..3c98986 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,6 +12,13 @@ export default { }), Pages(), Markdown({ + excerpt: true, + frontmatterOptions: { + grayMatterOptions: { + excerpt: true, + excerpt_separator: '', + }, + }, headEnabled: true, markdownItSetup(md) { // @ts-ignore