feat: add image module
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc.js";
|
||||
import type { BlogParsedContent } from "@/shared/types";
|
||||
import { calcReadingTime } from "@/shared/readingTime";
|
||||
|
||||
dayjs.extend(utc);
|
||||
import { calcReadingTime, getPrettyDate } from "@/shared/metadata";
|
||||
|
||||
const docs = await queryContent<BlogParsedContent>("/blog")
|
||||
.sort({ date: 1 })
|
||||
@@ -12,9 +8,7 @@ const docs = await queryContent<BlogParsedContent>("/blog")
|
||||
.find();
|
||||
|
||||
const latest = docs.at(-1) as BlogParsedContent;
|
||||
|
||||
const latestDate = dayjs(latest.date).utc();
|
||||
const prettyDate = latestDate.format("DD MMM YYYY");
|
||||
const prettyDate = getPrettyDate(latest);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@@ -1,10 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { StoryParsedContent, BlogParsedContent } from "@/shared/types";
|
||||
import { calcReadingTime } from "@/shared/readingTime";
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc.js";
|
||||
|
||||
dayjs.extend(utc);
|
||||
import { calcReadingTime, getPrettyDate } from "@/shared/metadata";
|
||||
|
||||
const { post, type, highlighttags } = defineProps<{
|
||||
post: StoryParsedContent | BlogParsedContent;
|
||||
@@ -12,11 +8,6 @@ const { post, type, highlighttags } = defineProps<{
|
||||
highlighttags?: string[];
|
||||
}>();
|
||||
|
||||
const getPrettyDate = (story: StoryParsedContent) => {
|
||||
const date = dayjs(story.date).utc();
|
||||
return date.format("DD MMM YYYY");
|
||||
};
|
||||
|
||||
const readingTime = calcReadingTime(post);
|
||||
const descText =
|
||||
type === "stories"
|
||||
|
@@ -1,10 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc.js";
|
||||
import { type StoryParsedContent } from "@/shared/types";
|
||||
import { calcReadingTime } from "@/shared/readingTime";
|
||||
|
||||
dayjs.extend(utc);
|
||||
import { calcReadingTime, getPrettyDate } from "@/shared/metadata";
|
||||
|
||||
const docs = await queryContent<StoryParsedContent>("/stories")
|
||||
.sort({ date: 1 })
|
||||
@@ -13,8 +9,7 @@ const docs = await queryContent<StoryParsedContent>("/stories")
|
||||
|
||||
const latest = docs.at(-1) as StoryParsedContent;
|
||||
|
||||
const latestDate = dayjs(latest.date).utc();
|
||||
const prettyDate = latestDate.format("DD MMM YYYY");
|
||||
const prettyDate = getPrettyDate(latest);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
10
components/content/image.vue
Normal file
10
components/content/image.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
const { src } = defineProps<{ src: string }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<figure>
|
||||
<img :src="`/images/posts/${src}`" />
|
||||
<figcaption class="text-center"><Markdown /></figcaption>
|
||||
</figure>
|
||||
</template>
|
Reference in New Issue
Block a user