我有一个带有查看帖子链接的索引路由。在帖子页面上,帖子都显示了标题链接,但是今天我在写另一篇博文时使用了 netflify CMS 我注意到现在帖子页面显示了指向 localhost:8000/blog/blog/{the-post- 的各个帖子链接姓名}。如果我从 url 中删除了“博客”部分之一,相关的帖子就会正确加载。我只是不明白为什么会发生这种情况,因为该网站之前运行良好。
该问题似乎与 {node.fields.slug} 错误链接有关
任何帮助表示赞赏!
盖茨比配置
module.exports = {
siteMetadata: {
// edit below
title: `Front-end Developer`,
author: `Alex Virdee`,
description: `A starter personal blog with styled components, dark mode, and Netlify CMS.`,
siteUrl: `https://hungry-bassi-27b875.netlify.app/`,
social: {
twitter: `alex_virdee`,
},
},
plugins: [
`gatsby-plugin-netlify-cms`,
`gatsby-plugin-styled-components`,
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-offline`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-feed-mdx`,
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/content/blog`,
name: `blog`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/content/assets`,
name: `assets`,
},
},
{ …Run Code Online (Sandbox Code Playgroud) 需要一些关于 JavaScript DOM 操作的帮助来将字符串分离到新行中。
我有一个围绕字符串的 div ......
<div id= "customer-comments">
// Div contains text of comments & no other wrapping HTML tags
Customer comment 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin in ligula neque. Aenean urna nisi, rutrum ac neque eu, aliquet aliquam ligula. Customer comment 2 - Etiam venenatis lacus quam, et imperdiet risus tempor quis. Aenean elit justo, fermentum ac leo vel, bibendum mattis est. Vestibulum sed condimentum mi, id ullamcorper libero
</div>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 …