mirror of
https://github.com/fmhy/edit.git
synced 2026-02-02 17:21:14 +11:00
posts setup
This commit is contained in:
parent
8f457fa166
commit
5ae23bea33
14 changed files with 528 additions and 229 deletions
27
.vitepress/theme/PostLayout.vue
Normal file
27
.vitepress/theme/PostLayout.vue
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<script setup lang="ts">
|
||||
import { useData } from "vitepress";
|
||||
import Authors from "./components/Authors.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
authors: string[];
|
||||
}>();
|
||||
|
||||
const formatDate = (raw: string): string => {
|
||||
const date = new Date(raw);
|
||||
return date.toLocaleDateString("en-US", {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
});
|
||||
};
|
||||
|
||||
const { frontmatter } = useData();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h3>
|
||||
{{ frontmatter.title }}
|
||||
</h3>
|
||||
|
||||
<span>{{ frontmatter.description }} • {{ formatDate(frontmatter.date) }}</span>
|
||||
<Authors :authors="props.authors" />
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue