因此,我试图找出如何渲染我的图片,是内联我的博客文章。我确实有一个功能突出的图片顶部工作,但不知道如何获得内联图像。
图像存储在src/images/中
office-upgrade.md
---
title: "Office Upgrade"
image: ../images/office1.jpg
featured: false
author:
name: "jrock2004"
date: "2017-08-06"
tags:
- general
---
So, when I moved into our new house 3
我已经将gatsby-plugin-layout安装到我的项目文件中,创建了src/layouts/index.js,并将gatsby-plugin-layout添加到gatsby-config.js中。Gatsby应用程序编译并可以在开发服务器上服务,但是通过我的布局组件的console.log输出,我看到布局组件仍然在每个页面加载上重新挂载。我的目标是让布局组件在反应应用的过程中只挂载一次。
src/layouts/index.js
import React from "react"
import Header from "../components/header&
我一直在使用盖茨比回购( Gatsby ),我注意到在某些情况下,如果不是一直调用窗口,我的部署将因以下错误而失败
4:57:03 AM: failed Building static HTML for pages - 1.305s
4:57:03 AM: error "window" is not available during server side rendering.
4:57:03 AM:
4:57:03 AM: 21 | }
4:57:03 AM: 22 | else {
4:57:03 AM: > 23 | _btoa = btoa.bi
我知道,作为函数的结果,不能将图像的源传递给StaticImage组件。但是,有谁能向我解释一下这两个例子的区别吗?
import React from 'react'
import { StaticImage } from 'gatsby-plugin-image' // to take image data and render it
export default function Example() {
const imageSrc = '../images/jonathan-adams.jpg'
const data = {