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

place toc perticuler position in a post #90

Open
vkosuri opened this issue Oct 13, 2019 · 1 comment
Open

place toc perticuler position in a post #90

vkosuri opened this issue Oct 13, 2019 · 1 comment

Comments

@vkosuri
Copy link

vkosuri commented Oct 13, 2019

Hi

I am new to Jekyll blogging, I don't wat add toc on top of the page, instead of after some line of text in a post I want to add toc, could you please let me know how to do this?

@siraisisatoru
Copy link

I am looking for a solution to a similar problem as well. By some googling, I figure out that I can separate the "excerpt" and the "rest content" using the Jekyll variable and liquid filter. Here is the solution for me:
The post.html in _layouts folder:

 <div class="entry">
    <div id="markdown-content">
          {{ page.excerpt }}
    </div>
    <div id="table-of-contents">
      {% toc %}
    </div>
    <div id="markdown-content">
          {{ page.content | remove: page.excerpt }}
    </div>
  </div>

A 2019-08-23-hello-world.md in _post folder:

---
layout: post
title: "Hello world! this is a testing post to the new layout!"
tags: [dev]
excerpt_separator: <!--more-->
toc: true
---
this is a short caption for this post 

try this out !
<!--more-->
## Hello world!
this is the first post in my new website for completely free!

this is an empty page for testing.
--- 

Then I got:

螢幕截圖 2020-08-29 上午1 09 53

I think this solves your issue. Sorry for the late late late reply.

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

2 participants