mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-30 00:04:06 -06:00
updated content meta
This commit is contained in:
parent
1a5d13da09
commit
91b4e806d7
@ -34,35 +34,52 @@ export default ((opts?: Partial<ContentMetaOptions>) => {
|
|||||||
|
|
||||||
if (fileData.dates) {
|
if (fileData.dates) {
|
||||||
const cfgDefaultDataType = cfg.defaultDateType // For backward compatibility, just in case this is used somewhere else by the original author
|
const cfgDefaultDataType = cfg.defaultDateType // For backward compatibility, just in case this is used somewhere else by the original author
|
||||||
//segments.push(formatDate(getDate(cfg, fileData)!, cfg.locale))
|
|
||||||
}
|
if (fileData.dates.created) {
|
||||||
if (fileData.dates.created) {
|
|
||||||
cfg.defaultDateType = "created"
|
cfg.defaultDateType = "created"
|
||||||
createdSegment = formatDate(getDate(cfg, fileData)!)
|
createdSegment = formatDate(getDate(cfg, fileData)!)
|
||||||
}
|
}
|
||||||
if (fileData.dates.modified) {
|
|
||||||
|
if (fileData.dates.modified) {
|
||||||
cfg.defaultDateType = "modified"
|
cfg.defaultDateType = "modified"
|
||||||
modifiedSegment = formatDate(getDate(cfg, fileData)!)
|
modifiedSegment = formatDate(getDate(cfg, fileData)!)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.defaultDateType = cfgDefaultDataType
|
cfg.defaultDateType = cfgDefaultDataType
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Display reading time if enabled
|
// Display reading time if enabled
|
||||||
|
var readingTimeStr: string = ""
|
||||||
if (options.showReadingTime) {
|
if (options.showReadingTime) {
|
||||||
const { minutes, words: _words } = readingTime(text)
|
const { minutes, words: _words } = readingTime(text)
|
||||||
const displayedTime = i18n(cfg.locale).components.contentMeta.readingTime({
|
const displayedTime = i18n(cfg.locale).components.contentMeta.readingTime({
|
||||||
minutes: Math.ceil(minutes),
|
minutes: Math.ceil(minutes),
|
||||||
})
|
})
|
||||||
segments.push(displayedTime)
|
// segments.push(displayedTime)
|
||||||
|
readingTimeStr = `${_words} words, ${displayedTime}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const segmentsElements = segments.map((segment) => <span>{segment}</span>)
|
//Created: {createdSegment} <br />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<p show-comma={options.showComma} class={classNames(displayClass, "content-meta")}>
|
<p class={classNames(displayClass, "content-meta")}>
|
||||||
{segmentsElements}
|
{readingTimeStr} <br />
|
||||||
|
Last updated on {modifiedSegment} <br />
|
||||||
|
🌟 <a href={`https://github.com/xy-241/CS-Notes/blame/v4/${fileRelativePath}`} class={classNames(displayClass, "external")} target={"_blank"} style={"font-weight:400"}>
|
||||||
|
Edit This Page!<svg class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg>
|
||||||
|
</a>
|
||||||
|
🗓️ <a href={`https://github.com/xy-241/CS-Notes/commits/v4/${fileRelativePath}`} class={classNames(displayClass, "external")} target={"_blank"} style={"font-weight:400"}>
|
||||||
|
History<svg class="external-icon" viewBox="0 0 512 512"><path d="M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"></path></svg>
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*const segmentsElements = segments.map((segment) => <span>{segment}</span>)
|
||||||
|
return (
|
||||||
|
<p show-comma={options.showComma} class={classNames(displayClass, "content-meta")}>
|
||||||
|
{segmentsElements}
|
||||||
|
</p>
|
||||||
|
)*/
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user