Skip to content

Commit cc4e17d

Browse files
authored
Merge pull request #701 from rareyesdev/fix/include-drafts-in-tag-data-during-development
fix: include drafts in tag data during development
2 parents ef87df5 + 8cc036a commit cc4e17d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contentlayer.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import siteMetadata from './data/siteMetadata'
2323
import { allCoreContent, sortPosts } from 'pliny/utils/contentlayer.js'
2424

2525
const root = process.cwd()
26+
const isProduction = process.env.NODE_ENV === 'production'
2627

2728
const computedFields: ComputedFields = {
2829
readingTime: { type: 'json', resolve: (doc) => readingTime(doc.body.raw) },
@@ -47,7 +48,7 @@ const computedFields: ComputedFields = {
4748
function createTagCount(allBlogs) {
4849
const tagCount: Record<string, number> = {}
4950
allBlogs.forEach((file) => {
50-
if (file.tags && file.draft !== true) {
51+
if (file.tags && (!isProduction || file.draft !== true)) {
5152
file.tags.forEach((tag) => {
5253
const formattedTag = GithubSlugger.slug(tag)
5354
if (formattedTag in tagCount) {

0 commit comments

Comments
 (0)