upstream #1
10
data/blog/my-fancy-title.md
Normal file
10
data/blog/my-fancy-title.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: My fancy title
|
||||||
|
date: '2021-01-31'
|
||||||
|
tags: ['hello']
|
||||||
|
draft: true
|
||||||
|
summary:
|
||||||
|
images: []
|
||||||
|
---
|
||||||
|
|
||||||
|
Draft post which should not display
|
@ -13,7 +13,7 @@ export async function getAllTags(type) {
|
|||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
const source = fs.readFileSync(path.join(root, 'data', type, file), 'utf8')
|
const source = fs.readFileSync(path.join(root, 'data', type, file), 'utf8')
|
||||||
const { data } = matter(source)
|
const { data } = matter(source)
|
||||||
if (data.tags) {
|
if (data.tags && data.draft !== true) {
|
||||||
data.tags.forEach((tag) => {
|
data.tags.forEach((tag) => {
|
||||||
const formattedTag = kebabCase(tag)
|
const formattedTag = kebabCase(tag)
|
||||||
if (formattedTag in tagCount) {
|
if (formattedTag in tagCount) {
|
||||||
|
@ -38,7 +38,7 @@ export async function getStaticProps({ params }) {
|
|||||||
return { props: { posts: filteredPosts, tag: params.tag } }
|
return { props: { posts: filteredPosts, tag: params.tag } }
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Blog({ posts, tag }) {
|
export default function Tag({ posts, tag }) {
|
||||||
// Capitalize first letter and convert space to dash
|
// Capitalize first letter and convert space to dash
|
||||||
const title = tag[0].toUpperCase() + tag.split(' ').join('-').slice(1)
|
const title = tag[0].toUpperCase() + tag.split(' ').join('-').slice(1)
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user