Migrate to astro v2

This commit is contained in:
prototypa
2023-01-21 18:19:18 -05:00
parent b575a89329
commit 09e827c035
9 changed files with 28 additions and 29 deletions

View File

@ -2,10 +2,11 @@ import getReadingTime from 'reading-time';
import { toString } from 'mdast-util-to-string';
export function remarkReadingTime() {
return function (tree, { data }) {
return function (tree, file) {
const text = toString(tree);
const readingTime = Math.ceil(getReadingTime(text).minutes);
data.astro.frontmatter.readingTime = readingTime;
const { frontmatter } = file.data.astro;
frontmatter.readingTime = readingTime;
};
}