如何将 link 添加到 Gatsby 配置文件

How to add link to Gatsby config file

我试图在 gatsby-config.js 文件中插入一个 link 作为快捷方式图标,但它似乎不起作用。显然我也在使用 graphql。

module.exports = {
  siteMetadata: {
    title: 'xxxx',
    description: 'xxxx',
    keywords:
      'test test test',
    link: [
      {
        rel: 'shortcut icon',
        url:
          'https://xxxx.png',
      },
    ],
  },
  plugins: ['gatsby-plugin-react-helmet'],
  plugins: [
    {
      resolve: 'gatsby-plugin-html-attributes',
      options: {
        lang: 'en',
      },
    },
  ],
}

Here 是您可以在 gatsby-cnfig 中添加的选项。来自文档:

Options available to set within gatsby-config.js include:

  1. siteMetadata (object)
  2. plugins (array)
  3. pathPrefix (string)
  4. polyfill (boolean)
  5. mapping (object)
  6. proxy (object)
  7. developMiddleware (function)

A​​ "link to a shortcut" 不属于这些选项。

TLDR:你不能。