问题标签 [jamstack]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
32 浏览

gatsby - Gatsby 将字符串转换为相对路径

我在页面的 frontmatter 中有一个字段my_field: /contact/。当我在页面上查询此字段时,它会转换为../pages/contact但我希望它与我输入的内容完全相同,只是/contact/.

如何防止 Gatsby 将我的字符串字段转换为相对路径?

编辑:我确实有一个来自“/pages/contact.js”的页面我的自定义字段来自一个试图链接到该页面的可配置导航。我想将 Gatsby Link 中的 /contact/ 传递给 param。但是在该字段中键入 /contact/ 会以 ../pages/contact 的形式出现。

0 投票
2 回答
366 浏览

nunjucks - 页