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

Tocbot may break the post.min.js #957

Closed
NichtsHsu opened this issue Mar 29, 2023 · 0 comments
Closed

Tocbot may break the post.min.js #957

NichtsHsu opened this issue Mar 29, 2023 · 0 comments

Comments

@NichtsHsu
Copy link
Contributor

NOTE: Before you start, the following should be completed.

Describe the bug

If a post do not have headers, tocbot.min.js will not be loaded becuase of:

{% if enable_toc %}
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[site.lang].panel.toc -}}</div>
<nav id="toc"></nav>
</div>
<!-- toc.js will be loaded at medium priority -->
<script src="{{ site.data.assets[origin].toc.js | relative_url }}"></script>
{% endif %}

But toc.js in post.min.js still executes and then cause a tocbot is not defined error, which will break post.min.js. I've added some custom scripts at the end of post.js, and they can't be executed in a post without headers for the reason mentioned above.

To Reproduce

Steps to reproduce the behavior:

  1. Create a post without any headers.
  2. Check console messages.

Expected behavior

Logs/Screenshots

Environment

Command Version
ruby -v 3.0.2p107
gem -v 3.3.5
bundle -v 2.3.13
bundle exec jekyll -v 4.3.2
bundle info jekyll-theme-chirpy 5.6.0

Additional context

@NichtsHsu NichtsHsu changed the title Tocbot may breaks the post.min.js Tocbot may break the post.min.js Mar 29, 2023
HOKAGO-MEMORIES added a commit to HOKAGO-MEMORIES/hokago-memories.github.io that referenced this issue Jan 18, 2024
HOKAGO-MEMORIES added a commit to HOKAGO-MEMORIES/hokago-memories.github.io that referenced this issue Jan 18, 2024
gudtldn pushed a commit to gudtldn/gudtldn.github.io that referenced this issue Jul 26, 2024
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

No branches or pull requests

1 participant