Skip to content

Conversation

jom-io
Copy link

@jom-io jom-io commented Feb 1, 2018

在使用hexo-blog-encrypt等加密插件的时候,
根据配置要求将 layout/_partial/post/toc.ejs改为

<% if(theme.toc){  %>
    <aside id="toc-div" class="post-widget" <% if (post.encrypt == true) { %>style="display:none" <% } %>>
        <nav class="post-toc-wrap" post-toc-shrink id="post-toc">
            <h4>TOC</h4>
                <% if (post.encrypt == true) {%>
                    <%- toc(post.origin, {
                            class: 'post-toc',
                            list_number: theme.toc.list_number
                        }) %>
                <% } else { %>
                    <%- toc(post.content, {
                            class: 'post-toc',
                            list_number: theme.toc.list_number
                        }) %>
                <% } %>
        </nav>
    </aside>
    <%
} %>

由于文章内容被加密,main.js中titles[0].id会出现 Uncaught TypeError: Cannot read property 'id' of undefined。此处等地适当加了一些判断修改。

@Brywmzl
Copy link

Brywmzl commented Aug 11, 2019

似乎还有有问题,目录还是出不来~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants