Node.js Express haml 无法正确渲染

发布于 2025-01-02 11:54:30 字数 353 浏览 2 评论 0原文

我针对此问题的存储库位于: https://github.com/okor/express_bad_haml

问题是我可以让应用程序正确渲染布局或页面,但不能同时渲染两者。结果是: http://farm8.staticflickr.com/7170/6818833785_80bcc2b2fe_z.jpg

我不确定我做错了什么。帮助?

My repo for this problem is at: https://github.com/okor/express_bad_haml

The problem is that I can get the app to render the layout correctly, or the page, but not both. Resulting in this: http://farm8.staticflickr.com/7170/6818833785_80bcc2b2fe_z.jpg

I'm not sure what I'm doing wrong. Help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

昔日梦未散 2025-01-09 11:54:31

您的浏览器似乎正在尝试将输出呈现为纯文本。尝试强制输出标头为 text/html:

res.writeHead(200, {'Content-Type': 'text/html'});

It seems like your browser is trying to render the output as plain text. Try to forcing the output header to text/html:

res.writeHead(200, {'Content-Type': 'text/html'});
情话已封尘 2025-01-09 11:54:31

好吧,我明白了。我之前设置过

app.set("视图选项", {layout: true});

我将该设置更改为

app.set("视图选项", {layout: false});

这解决了问题。

Ok, I figured it out. I had previously set

app.set("view options", {layout: true});

I changed that setting to

app.set("view options", {layout: false});

And that fixed the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文