Skip to content

Commit

Permalink
Fix astro check errors
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypa committed Dec 11, 2024
1 parent 6570377 commit 8544668
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/components/blog/Tags.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
6 changes: 4 additions & 2 deletions src/utils/frontmatter.ts
Original file line number Diff line number Diff line change
@@ -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;
}
};
};

Expand Down

0 comments on commit 8544668

Please sign in to comment.