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