Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

Feature Request for toc #30

Open
cenalulu opened this issue Apr 12, 2015 · 8 comments
Open

Feature Request for toc #30

cenalulu opened this issue Apr 12, 2015 · 8 comments

Comments

@cenalulu
Copy link

adjustable position for toc

When writing extreme long articles, the first sight of a page will be filled by toc section, which is not pleasant. If it is possible to put toc section to ads section's current location, that will be nice

back to top

For a very long article (which you have to scroll several pages to the end), it is very helpful if we could add a feature "back to top" whether as button or href near subtitle.

PS: Very nice work for skinny-bones-jekyll and continuous refinement, I really enjoy this template.

@mmistakes
Copy link
Owner

The back to top button link is a good idea and pretty easy to do since I added one to my personal site (which is what Skinny Bones is based off of). Should be no problem for me to port it over when I get a free minute.

Table of Contents is a little trickier. I kept it simple because I figured there would be a lot of variation on where people want to place it. I agree, off in the sidebar would be a better place for it. The challenge is when using Kramdown's auto TOC feature, it's not the easiest thing to stick outside of the main content block because it needs the post/page Markdown to generate it.

Also, the way the grid is currently set, when you collapse the site into a smaller viewport (on mobile for example) the sidebar comes after the main content which means the TOC would display after. For ads that's probably a good thing since the content should come first, but if you have a TOC there then it defeats the purpose unless the entire grid is reworked.

The other solution is to use Javascript to build a TOC and then place that wherever you want. I had done that before but opt'd to include the TOC in the actual HTML since I'm not generally a fan of using Javascript to build out content related things.

@ghost
Copy link

ghost commented May 7, 2015

+1

@Phlow
Copy link

Phlow commented May 7, 2015

Hi! The table of content thing, is quite easy. You don't need to integrate it. Just use kramdown as a markdown parser...

in _config.yml

enter

markdown: kramdown

...and use this code:

{: #toc }
*  TOC
{:toc}

...in your markdown-file :)

Example: https://phlow.github.io/feeling-responsive/documentation/

@mmistakes
Copy link
Owner

@Phlow The Kramdown auto toc only works when you're ok with displaying the table of contents within {{ content }}. @cenalulu was asking to put the toc outside of that in another container, which is why I suggested using a jQuery plugin since you have more flexibility to insert it into wherever you'd want.

In the future when flexbox has better support that would be the way to setup the grid of the page. Would make shuffling the source order of content blocks way easier.

@Phlow
Copy link

Phlow commented May 7, 2015

Ah, ok, I understand. I am using the foundation grid and have a special layout called page-fullwidth. With this layout you can set up your own grid and push the toc whereever you want. But the requested feature is more convenient.

Maybe it's possible to combine content with toc by assigning both of them into a string and than parse the string with a filter like markdownify.

@mmistakes
Copy link
Owner

That would great if there was some way to combine the two. The only way I've been able to customize the Kramdown toc was to create a html snippet with some markup around it (grid classes, etc), and then call that into a post using {{ include toc.html }}.

Works fine if you don't mind the toc content being in the same container element as {{ content }} but moving it outside of it becomes tricky. Not to mention if you're a Markdown purist and don't want to junk up your posts/pages with HTML it can look messy. I personally don't care about that, but I know some do.

@Phlow
Copy link

Phlow commented May 7, 2015

You're right. Should you stumble upon a handy solution – I don't like a javascript-version – please tell me if you have the time. All the Best from Germany, mo.

@mmistakes
Copy link
Owner

Agreed. I'm not a fan of the Javascript version either. I prefer that
content to be on the page directly.

The only other solution I've seen is by manually building a toc in the
post/page's YAML Front Matter or even using _data files. But that seems
like a maintenance nightmare.

On Thu, May 7, 2015 at 12:18 PM, Moritz »mo.« Sauer <
[email protected]> wrote:

You're right. Should you stumble upon a handy solution – I don't like a
javascript-version – please tell me if you have the time. All the Best from
Germany, mo.


Reply to this email directly or view it on GitHub
#30 (comment)
.

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

No branches or pull requests

3 participants