Skip to content

Commit

Permalink
[#157] FIX: post detail 404
Browse files Browse the repository at this point in the history
  • Loading branch information
mazipan committed Jul 22, 2024
1 parent b64a1a4 commit 9912399
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pages/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Related from '@/components/Post/Related'

import LayoutArticle from '@/components/Layout/Article'

import { getPostBySlug, getAllPosts, getRelatedPost } from '@/lib/api'
import { getPostBySlug, getAllPosts, getRelatedPost, DEFAULT_FIELDS } from '@/lib/api'
import { SITE_METADATA } from '@/lib/constants'

export default function Post ({ post, related, preview }) {
Expand Down Expand Up @@ -99,7 +99,7 @@ export async function getStaticProps ({ params }) {
}

export async function getStaticPaths () {
const posts = await getAllPosts(['slug'])
const posts = await getAllPosts(DEFAULT_FIELDS, 'id')

return {
paths: posts.map((post) => {
Expand Down
4 changes: 2 additions & 2 deletions pages/en/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Related from '@/components/Post/Related'

import LayoutArticle from '@/components/Layout/Article'

import { getPostBySlug, getAllPosts, getRelatedPost } from '@/lib/api'
import { getPostBySlug, getAllPosts, getRelatedPost, DEFAULT_FIELDS } from '@/lib/api'
import { SITE_METADATA } from '@/lib/constants'

export default function Post({ post, related, preview }) {
Expand Down Expand Up @@ -98,7 +98,7 @@ export async function getStaticProps({ params }) {
}

export async function getStaticPaths() {
const posts = await getAllPosts(['slug'], 'en')
const posts = await getAllPosts(DEFAULT_FIELDS, 'en')

return {
paths: posts.map((post) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/rss-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require('fs')
const path = require('path')
const Feed = require('feed').Feed

const { getAllPosts } = require('../lib/api')
const { getAllPosts, DEFAULT_FIELDS } = require('../lib/api')
const { getAllTils } = require('../lib/tils')
const { SITE_METADATA } = require('../lib/constants')

Expand All @@ -29,7 +29,7 @@ async function main () {
})

const posts = await getAllPosts(
['title', 'date', 'slug', 'author', 'coverImage', 'excerpt'],
DEFAULT_FIELDS,
'id'
)

Expand Down
4 changes: 2 additions & 2 deletions scripts/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const fs = require('fs')
const path = require('path')
const nanositemap = require('nanositemap')

const { getAllPosts, getAllTags } = require('../lib/api')
const { getAllPosts, getAllTags, DEFAULT_FIELDS } = require('../lib/api')
const { getAllTils } = require('../lib/tils')
const { SITE_METADATA } = require('../lib/constants')

async function main () {
const sitemapObj = {}
const posts = await getAllPosts(['date', 'slug'], 'id')
const posts = await getAllPosts(DEFAULT_FIELDS, 'id')

for (const post of posts) {
sitemapObj[`/${post.slug}`] = {
Expand Down

1 comment on commit 9912399

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ“± Mobile Device

Page: https://www.mazipan.space/

Perf Core Web Vitals Timings Resources
FID LCP CLS FCP FCI TBT TTI SI Resources Count Resources Size
🟠 75/100 0ms 2,455ms 0.004 2,414ms 0ms 808ms 6,232ms 2,414ms 36ms 445kB

πŸ’» Desktop Device

Page: https://www.mazipan.space/

Perf Core Web Vitals Timings Resources
FID LCP CLS FCP FCI TBT TTI SI Resources Count Resources Size
🟒 100/100 0ms 697ms 0.003 677ms 0ms 48ms 1,633ms 677ms 44ms 551kB

πŸ‘‹ Generated by psi-github-action

πŸ“– Learn about the abbreviation

Please sign in to comment.