Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决加密文章寻找不到Toc列表错误 #370

Open
wants to merge 1 commit into
base: card
Choose a base branch
from

Conversation

zoeldu
Copy link

@zoeldu zoeldu 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.

None yet

2 participants