Skip to content

Commit

Permalink
remove toc header if a content has no header
Browse files Browse the repository at this point in the history
  • Loading branch information
watahani committed May 1, 2023
1 parent 14b1cb2 commit fb3aa6d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@
} else if ((config.toc && config.toc.enabled) || (post.toc && post.toc.enabled)){
var tocOptions = Object.assign({}, config.toc, post.toc);
%>
<% var tocContent =toc (post.content, tocOptions);
if (tocContent) { %>
<div class="toc-wrapper">
<h2 id="toc-header" class="toc-header">この記事の内容</h2>
<%- toc(post.content, tocOptions) %>
<%- tocContent %>
</div>
<% } %>
<% }
} %>
<%- post.content %>
<% } %>
<% if (!post.disableDisclaimer && config.disclaimer){ %>
Expand Down

0 comments on commit fb3aa6d

Please sign in to comment.