gatsby-starter-blog的站点地图

时间:2017-09-13 10:55:37

标签: sitemap gatsby

目前我在为gatsby-starter-blog生成sitemap.xml时遇到问题。 http://localhost:8000/sitemap.xml仍未找到。

我现在在做什么:

  • npm install gatsby-plugin-sitemap
  • 添加网站元
<div class="form-group">
            @Html.LabelFor(model => model.Gender, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("Gender", new List<SelectListItem> { new SelectListItem { Text="Male", Value="Male" },
               new SelectListItem { Text="Female", Value="Female"}
           }, "Select Gender")
                @* new { htmlAttributes = new { @class = "form-control" } })*@
                @Html.ValidationMessageFor(model => model.Gender, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.City, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.City, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.City, "", new { @class = "text-danger" })
            </div>
        </div>
  • 这里是我的代码gatsby-node.js
siteMetadata: 
{
    siteUrl: 'http://www.localhost:8000',
  },
plugins: [ 
  {
    resolve: 'gatsby-plugin-sitemap',          
  },
]

1 个答案:

答案 0 :(得分:1)

onPostBuild仅在构建过程中被调用,而不是开发,看起来你还没有运行。尝试运行gatsby build,然后运行onPostBuild实施。