Merge pull request #701 from rareyesdev/fix/include-drafts-in-tag-data-during-development
fix: include drafts in tag data during development
This commit is contained in:
commit
cc4e17d5b1
@ -23,6 +23,7 @@ import siteMetadata from './data/siteMetadata'
|
||||
import { allCoreContent, sortPosts } from 'pliny/utils/contentlayer.js'
|
||||
|
||||
const root = process.cwd()
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
|
||||
const computedFields: ComputedFields = {
|
||||
readingTime: { type: 'json', resolve: (doc) => readingTime(doc.body.raw) },
|
||||
@ -47,7 +48,7 @@ const computedFields: ComputedFields = {
|
||||
function createTagCount(allBlogs) {
|
||||
const tagCount: Record<string, number> = {}
|
||||
allBlogs.forEach((file) => {
|
||||
if (file.tags && file.draft !== true) {
|
||||
if (file.tags && (!isProduction || file.draft !== true)) {
|
||||
file.tags.forEach((tag) => {
|
||||
const formattedTag = GithubSlugger.slug(tag)
|
||||
if (formattedTag in tagCount) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user