Skip to content

Commit

Permalink
feat(head and body template): 支持在front-matter中动态插入css和js,支持引入多个 (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
lovelyJason authored May 6, 2023
1 parent 0dfa967 commit 3146360
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
<!-- Custom Files headBegin begin-->
<%- volantis_inject('headBegin') %>
<!-- Custom Files headBegin end-->
<!-- front-matter head_begin begin -->
<%_ if (page.import && page.import.head_begin){ _%>
<%_ getList(page.import.head_begin).forEach(function(item){ _%>
<%- item %>
<%_ }) _%>
<%_ } _%>
<!-- front-matter head_begin end -->
<%_ if (config.favicon) { _%>
<link rel="shortcut icon" type='image/x-icon' href="<%- url_for(config.favicon) %>">
<%_ } _%>
Expand Down Expand Up @@ -76,4 +83,11 @@
<!-- Custom Files headEnd begin-->
<%- volantis_inject('headEnd') %>
<!-- Custom Files headEnd end-->
<!-- front-matter head_end begin -->
<%_ if (page.import && page.import.head_end){ _%>
<%_ getList(page.import.head_end).forEach(function(item){ _%>
<%- item %>
<%_ }) _%>
<%_ } _%>
<!-- front-matter head_end end -->
</head>
14 changes: 14 additions & 0 deletions layout/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
<!-- Custom Files bodyBegin begin-->
<%- volantis_inject('bodyBegin') %>
<!-- Custom Files bodyBegin end-->
<!-- front-matter body_begin begin -->
<%_ if (page.import && page.import.body_begin){ _%>
<%_ getList(page.import.body_begin).forEach(function(item){ _%>
<%- item %>
<%_ }) _%>
<%_ } _%>
<!-- front-matter body_begin end -->
<%- partial('_partial/header', null, {cache: false, path: path}) %>
<div id="l_body">
<%- partial('_partial/cover') %>
Expand Down Expand Up @@ -41,5 +48,12 @@
<!-- Custom Files bodyEnd begin-->
<%- volantis_inject('bodyEnd') %>
<!-- Custom Files bodyEnd end-->
<!-- front-matter body_end begin -->
<%_ if (page.import && page.import.body_end){ _%>
<%_ getList(page.import.body_end).forEach(function(item){ _%>
<%- item %>
<%_ }) _%>
<%_ } _%>
<!-- front-matter body_end end -->
</body>
</html>

0 comments on commit 3146360

Please sign in to comment.