在Jade中添加页脚或其他部分

3
我希望在我的Express应用程序的所有页面上添加页脚。我按照这篇相关教程进行操作:http://www.devthought.com/code/use-jade-blocks-not-layouts/,但好像还缺少一些东西。以下是我的代码: layout.jade
doctype html
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
    block content

    block footer

footer.jade

extends layout

block footer
  footer
    ul
      li
        a(href="/team") Team
      li
        a(href="/privacy") Privacy
      p
        | company name <br> 
        | &copy; 2014, All Rights Reserved
1个回答

9

显然使用 includes 是行得通的。由于它在所有页面上都是相同的,因此我将其添加到了我的布局中。

layout.jade

doctype html
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
    block content

    include footer

2
评论来自未来。感谢您回来完成这个故事。 - swyx

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接