Skip to content

Commit

Permalink
修正模板引擎的配置,问题表现为 init-site 时首页不能生成列表
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoqiang-zhao committed Feb 1, 2016
1 parent 00a89f9 commit b68888d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 41 deletions.
3 changes: 3 additions & 0 deletions tool/publish/lib/init-index-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
var fs = require('fs');
var config = require('./config.js');
var ejs = require('ejs');
// 当和 init-site 集成使用时需要重置配置
ejs.open = '<%';
ejs.close = '%>';

function initPage(articleArr) {
// 主人首页
Expand Down
17 changes: 0 additions & 17 deletions tool/publish/lib/init-src.js

This file was deleted.

4 changes: 0 additions & 4 deletions tool/publish/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ var articleArr = getArticleArr(config);
var initDataJson = require('./init-json-data.js');
initDataJson(articleArr);

// 初始化资源文件
var initSrc = require('./init-src.js');
initSrc();

// 生成首页
var initIndexPage = require('./init-index-page.js');
initIndexPage(articleArr);
Expand Down
20 changes: 10 additions & 10 deletions web/index-owner.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ <h2>
</h2>
</header>
<div class="page-body article-list-container">
<% articleArr.forEach(function(article){ %>

<article>
<a href="<%=article.detailPagePath %>">
<h1><%=article.jsonData.title %></h1>
<a href="/articles/example/main.html">
<h1>示例文章</h1>
<summary>
<%=article.jsonData.introduction %>
文章说明,出现在文章列表页。
</summary>
</a>
<%if (article.jsonData.tags.length > 0){%>

<footer>
<section>
<i>Tags</i>
<%article.jsonData.tags.forEach(function(tag){%>
<a href=""><%=tag%></a>
<%})%>

<a href="">示例 Tag</a>

</section>
</footer>
<%}%>

</article>
<% }) %>

</div>
</body>
</html>
20 changes: 10 additions & 10 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ <h2>
</h2>
</header>
<div>
<% articleArr.forEach(function(article){ if(article.jsonData.isPublished){%>

<article>
<a href="<%=article.detailPagePath %>">
<h1><%=article.jsonData.title %></h1>
<a href="/articles/example/main.html">
<h1>示例文章</h1>
<summary>
<%=article.jsonData.introduction %>
文章说明,出现在文章列表页。
</summary>
</a>
<%if (article.jsonData.tags.length > 0){%>

<footer>
<section>
<i>Tags:</i>
<%article.jsonData.tags.forEach(function(tag){%>
<a href=""><%=tag%></a>
<%})%>

<a href="">示例 Tag</a>

</section>
</footer>
<%}%>

</article>
<%}})%>

</div>
</noscript>
</body>
Expand Down

0 comments on commit b68888d

Please sign in to comment.