Silviu LorenČ›
2024-02-17 fa2ea2896f0977253733334199d28e509351e621
quartz/components/ContentMeta.tsx
@@ -2,6 +2,7 @@
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
import readingTime from "reading-time"
import { classNames } from "../util/lang"
import { i18n } from "../i18n"
interface ContentMetaOptions {
  /**
@@ -30,8 +31,11 @@
      // Display reading time if enabled
      if (options.showReadingTime) {
        const { text: timeTaken, words: _words } = readingTime(text)
        segments.push(timeTaken)
        const { minutes, words: _words } = readingTime(text)
        const displayedTime = i18n(cfg.locale).components.contentMeta.readingTime({
          minutes: Math.ceil(minutes),
        })
        segments.push(displayedTime)
      }
      return <p class={classNames(displayClass, "content-meta")}>{segments.join(", ")}</p>