Remove readingTime

This commit is contained in:
prototypa
2023-01-23 18:00:10 -05:00
parent 7155c5ff23
commit b3f71b1297
5 changed files with 5 additions and 14 deletions

View File

@ -10,7 +10,6 @@ import mdx from '@astrojs/mdx';
import partytown from '@astrojs/partytown'; import partytown from '@astrojs/partytown';
import compress from 'astro-compress'; import compress from 'astro-compress';
import { remarkReadingTime } from './src/utils/frontmatter.mjs';
import { SITE } from './src/config.mjs'; import { SITE } from './src/config.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = path.dirname(fileURLToPath(import.meta.url));
@ -56,9 +55,7 @@ export default defineConfig({
}), }),
], ],
markdown: { markdown: {},
remarkPlugins: [remarkReadingTime],
},
vite: { vite: {
resolve: { resolve: {

View File

@ -44,8 +44,7 @@ const link = !BLOG?.post?.disabled ? getPermalink(post.slug, 'post') : '';
<div class="mb-1"> <div class="mb-1">
<span class="text-sm"> <span class="text-sm">
<Icon name="tabler:clock" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" /> <Icon name="tabler:clock" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" />
<time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time> ~ <time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time>
{Math.ceil(post.readingTime)} min read
</span> </span>
</div> </div>
<h2 class="text-xl sm:text-2xl font-bold leading-tight mb-2 font-heading dark:text-slate-300"> <h2 class="text-xl sm:text-2xl font-bold leading-tight mb-2 font-heading dark:text-slate-300">

View File

@ -23,9 +23,7 @@ const { post, url } = Astro.props;
<div class="flex justify-between flex-col sm:flex-row max-w-3xl mx-auto mt-0 mb-2 px-4 sm:px-6 sm:items-center"> <div class="flex justify-between flex-col sm:flex-row max-w-3xl mx-auto mt-0 mb-2 px-4 sm:px-6 sm:items-center">
<p> <p>
<Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-1 dark:text-gray-400" /> <Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-1 dark:text-gray-400" />
<time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time> ~ { <time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time>
Math.ceil(post.readingTime)
} min read
</p> </p>
</div> </div>
<h1 <h1

View File

@ -20,7 +20,6 @@ export interface Post {
Content: unknown; Content: unknown;
content?: string; content?: string;
readingTime: number;
} }
export interface MetaSEO { export interface MetaSEO {

View File

@ -5,7 +5,7 @@ import { cleanSlug } from './permalinks';
const getNormalizedPost = async (post: CollectionEntry<'posts'>): Promise<Post> => { const getNormalizedPost = async (post: CollectionEntry<'posts'>): Promise<Post> => {
const { id, slug = '', data } = post; const { id, slug = '', data } = post;
const { Content, remarkPluginFrontmatter } = await post.render(); const { Content } = await post.render();
const { tags = [], category = 'default', author = 'Anonymous', publishDate = new Date(), ...rest } = data; const { tags = [], category = 'default', author = 'Anonymous', publishDate = new Date(), ...rest } = data;
@ -22,8 +22,6 @@ const getNormalizedPost = async (post: CollectionEntry<'posts'>): Promise<Post>
Content: Content, Content: Content,
// or 'body' in case you consume from API // or 'body' in case you consume from API
readingTime: remarkPluginFrontmatter?.readingTime,
}; };
}; };