- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我还是 React 的新手。我只是想让我的投资组合用好的技术构建。我对 gatsbyjs 很感兴趣。现在,我得到了一个错误。它说
未知论点'frontmatter'我对此一无所知。这与 graphql 或 gatsbyjs 有关吗?有人可以帮我解决这个问题吗?
我正在从“LevelUp 教程” channel 观看 youtube 教程。
https://www.youtube.com/watch?v=VxVKMJThh04&list=PLLnpHn493BHHfoINKLELxDch3uJlSapxg&index=5
import React from 'react'
import Helmet from 'react-helmet'
import { graphql } from "gatsby"
export default function Template({ data }) {
const { markdownRemark: post } = data; //sama dengan const post=data.markdownRemark
// const { markdownRemark } = data // data.markdownRemark holds our post data
return (
<div>
<h1>{post.frontmatter.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.html }} />
</div>
)
}
export const postQuery = graphql`
query BlogPostByPath($path : String!){
markdownRemark(frontmatter:{path: { eq:$path}}){
html
frontmatter{
path
title
}
}
}
最佳答案
转到您的 gatsby-config.js。
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/pages`,
},
},
确保您的页面文件夹或子文件夹中有(有)*.md 文件。
这解决了我的问题,未知参数“frontmatter”。如果它不适合您,请查看教程。 Creating a Blog with Gatsby
关于javascript - 为什么我的 gatsby 应用程序显示 Unknown argument 'frontmatter' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58015949/
如何在帖子前言中使用站点 _config.yml 中的变量? 我想做这样的事情 --- github-id: site.github-id --- 然而,这实际上将其设置为字符串“site.githu
我想使用 Jekyll 将我的 WordPress 网站转换为 GitHub 上的静态网站。 我使用一个插件将我的 62 篇文章作为 Markdown 导出到 GitHub。我现在有这些帖子,每个文件
我有一个定义了 frontmatter 的 mdx gatsby 页面。 --- title: About Me path: /about description: Some information
我想使用 ' 或易于从键盘输入的东西而不是 ' 关于如何做到这一点的任何想法?我试图逃脱,但仍然无济于事。 --- title: 'that's great' --- 此外,如果某些页面存在此错误,构
我最近开始尝试使用 Jekyll(v 3.0.1,在 Ubuntu 上使用 Ruby 2.2.3p173),我不确定我是否发现了错误或者它是某种 PEBKAC。 我有几篇文章,我想使用它们在 fron
好的,所以我想要完成的是在我的主页上显示我最新的漫画,它的标题和描述。我所有的漫画都在 "/comics/#" 中。漫画的标题和描述在首页,并通过布局添加到页面。我在 _config.yml 文件中保
我已经使用 mdx 建立了一个 next.js markdown 博客:https://mdxjs.com/ . 我希望能够在 mdx 文件本身的 frontmatter 部分中引用数据。像这样: /
根据Jekyll's frontmatter在文档中,date 变量可用于指定发布帖子的日期和时间。 Jekyll 在这里期望哪种日期格式?我见过的一些例子,例如: date: 2010-09-15
在子布局中,是否可以定义一个 frontmatter 变量,其范围仅限于使用该布局的模板? 例如,给定一个子布局child.hbs: --- layout: parent.hbs layout_scr
在 ruby 中是否有某种方法可以编辑 markdown 文件顶部的 YAML Frontmatter,就像 Jekyll 和 Middleman 中使用的那样? 类似于: def update_
我有一堆 Markdown 文件,我想在我的网站上发布它们。我用 Jekyll 摆弄了一段时间,这似乎是一个很好的工具,但我的问题是我想在其他网站(如 Medium)上发布我的文件,而 FrontMa
我希望最外层的 Liquid 模板文件仅在页面需要时才引用 JavaScript 文件。我创建了一个页面变量,page.slideshow ,它控制这个: 默认.html: {% if page.sl
第一次尝试 Gatsby ,很高兴。但是我遇到了一个奇怪的 GraphQL 问题: 我正在使用 gatsby-source-filesystem 和 gatsby-transformer-remark
我想将 gulp frontmatters 输出传递给我在 Gulp(gulp 模板)中使用的另一个函数。我想我的语法是正确的,但一定是做错了什么,因为它不起作用。 我使用的 gulp 插件是:Gul
好的...我有一个项目,我在其中使用 Jekyll 进行播客项目。我选择通过 YAML Front Matter 项目在 shownotes 中列出主机: hosts: - Name A -
我需要加载来自 Markdown 元数据的图像 --- title: 'First Blog' description: 'First blog description' image: ../../c
我正在尝试使用以下 graphQL 查询: { allMarkdownRemark( limit: 1000 ) { edges {
我还是 React 的新手。我只是想让我的投资组合用好的技术构建。我对 gatsbyjs 很感兴趣。现在,我得到了一个错误。它说 未知论点'frontmatter'我对此一无所知。这与 graphql
有没有一种简单的方法可以在 Gatsby 上将 frontmatter 内容转换为 html,而不仅仅是在 Markdown 时将该内容设置为 html 本身? 所以在这个例子中: --- about
我想使用 emacs 的 org-mode 为我的 Jekyll 驱动的博客写博文。读书Using org to Blog with Jekyll , 通常所做的是将您的前端内容放在 #+BEGIN_
我是一名优秀的程序员,十分优秀!