place toc perticuler position in a post
Opened this issue · 1 comments
vkosuri commented
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 commented
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:
I think this solves your issue. Sorry for the late late late reply.