Fix astro check errors

This commit is contained in:
prototypa
2024-12-10 19:39:48 -05:00
parent 6570377a30
commit 8544668963
2 changed files with 9 additions and 9 deletions

View File

@@ -17,13 +17,11 @@ const { tags, class: className = 'text-sm', title = undefined, isCategory = fals
{
tags && Array.isArray(tags) && (
<>
<>
{title !== undefined && (
<span class="align-super font-normal underline underline-offset-4 decoration-2 dark:text-slate-400">
{title}
</span>
)}
</>
{title !== undefined && (
<span class="align-super font-normal underline underline-offset-4 decoration-2 dark:text-slate-400">
{title}
</span>
)}
<ul class={className}>
{tags.map((tag) => (
<li class="bg-gray-100 dark:bg-slate-700 inline-block mr-2 rtl:mr-0 rtl:ml-2 mb-2 py-0.5 px-2 lowercase font-medium">

View File

@@ -1,14 +1,16 @@
import getReadingTime from 'reading-time';
import { toString } from 'mdast-util-to-string';
import { visit } from 'unist-util-visit';
import type { MarkdownAstroData, RehypePlugin, RemarkPlugin } from '@astrojs/markdown-remark';
import type { RehypePlugin, RemarkPlugin } from '@astrojs/markdown-remark';
export const readingTimeRemarkPlugin: RemarkPlugin = () => {
return function (tree, file) {
const textOnPage = toString(tree);
const readingTime = Math.ceil(getReadingTime(textOnPage).minutes);
(file.data.astro as MarkdownAstroData).frontmatter.readingTime = readingTime;
if (typeof file?.data?.astro?.frontmatter !== "undefined") {
file.data.astro.frontmatter.readingTime = readingTime;
}
};
};