SO中文参考
首页
(current)
程序语言
c
java
python
c++
go
javascript
swift
c#
操作系统
linux
ubuntu
centos
unix
数据库
oracle
mysql
mongodb
postgresql
框架
node.js
angular
react-native
avalon
django
twisted
hadoop
.net
移动开发
android
ios
搜索
与Go Fiber模板引擎一起使用时,我无法在小胡子中获取部分内容{{标题}}</</desc> <question vote="2"> <p>我正在尝试为我的网站创建一个布局,其中我对页眉和页脚使用部分内容。</p> <pre><code> <!DOCTYPE html> <html lang="en"> <head> <title>{{title}}</title> <script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" data-cfemail="0f677b627721607d684f3e21362136">[email protected]</a>" crossorigin="anonymous"></script> <link href='/static/css/global.css' rel='stylesheet'> <link href='https://fonts.googleapis.com/css?family=Rubik' rel='stylesheet'> </head> <body> {{> views/partials/header }} {{{embed}}} {{> views/partials/footer }} </body> </html> </code></pre> <p>我按照此处所示的示例进行操作:<a href="https://stackoverflow.com">https://docs.go Fiber.io/template/mustache/</a></p> <p>嵌入工作正常,但部分不起作用。</p> <p>我的文件结构是这样的:</p> <pre><code>views ├── layout.mu └── partials ├── header.mu └── footer.mu </code></pre> <p>这是我如何设置应用程序和路线:</p> <pre><code>engine := mustache.New("./views", ".mu") app := fiber.New(fiber.Config{Views: engine}) app.Get("/", func(c *fiber.Ctx) error { return c.Render("index", fiber.Map{ "title": "index", }, "layout") }) </code></pre> <p>最后这是我的标题:</p> <pre><code><nav class="navigation"> <a href="/"><img alt="" class="logo" src="/static/images/logo.png"/></a> <ul class="items"> <li> <a class="links" href="/product">Produkt</a> </li> <li> <a class="links" href="/blog">Blogg</a> </li> <li> <a class="links" href="/about">Om Oss</a> </li> <li> <a class="links contact" href="/contact">Kontakta Oss</a> </li> </ul> </nav> </code></pre> </question> <answer tick="false" vote="0"> <p>我想你现在可能已经解决了。 但对于未来的用户,我将解决方案发布在这里。</p> <p>文件扩展名必须是 <pre><code>.mustache</code></pre>,否则模板引擎将无法从包含的部分文件中渲染文件。</p> </answer> </body></html>
问题描述
投票:0
回答:0
go
mustache
go-fiber
最新问题
如何在 Azure Function 应用程序中模拟库依赖项,而不将库添加为测试项目的依赖项?
如何分割导航栏选项卡中出现的两个单词?
自动以闪亮的方式绘制
如何使用 JavaScript 禁用 <script> 元素
如何在Unity中阻止Steam VR摄像头在虚拟环境中物理地透过墙壁偷看
如何使用 setw() 使第一个数字始终对齐
可用于 Swift 的 API 提供与当前 macOS 用户关联的 Apple ID?
将应用程序内容添加到错误报告
DataGridView 我想格式化从当前日期 2024-11-18T10:59:00.000+0000 到 2024-11-18 的第十个单元格中的日期
如何使用反应函数输出的数据作为条件面板中的条件?
从 Jetpack Compose 列表中删除项目的动画
在 Visual Studio 中(理想情况下)我想将文本拆分并插入到字符串中
使用 colorpicker 中的 colorInput 时将颜色小部件置于前面
ggplot中可以使用if_else根据数据改变ylim吗?
如何在 Neovim 的 `init.vim` 配置中正确获取/使用 lua 文件?
如何计算Tensorflow中softmax值的期望值?
SwiftUI 图像未填充小部件
更改导航对话框的背景(jetpack compose)
STM32 USB CDC 的最大速度是多少?
当其他人向我的存储库提出拉取请求时发出
© www.soinside.com 2019 - 2024. All rights reserved.