Table of Contents in pages #87
Labels
No Label
dependencies
in progress
kind/bug
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/security
kind/testing
kind/translation
kind/ui
lgtm/done
lgtm/need 1
lgtm/need 2
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
status/blocked
status/needs-feedback
status/wip
No Milestone
No Assignees
4 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/theme#87
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Would make pages more readable imo. Happy to issue a PR.
All it needs is the following in
layouts/doc/single.html
(the wordcount condition is optional but I think it makes sense)
This looks great! I'm not entirely familiar with all the things Hugo allows, but is it possible to selectively disable this?
The theme is used for more then the docs (blog being my main concern for hitting the word count), and we may not always want a TOC.
Alternatively, selectively enabling might be better. Most, if not all, docs pages would probably benefit from a TOC.
I think hugo supports settings "per post"(or content page), and we could have
toc: true
on the longer pages?so pulls like https://github.com/go-gitea/gitea/pull/13836 would not be needed ?
I like the look of 13836 (Page Title - description/summary - TOC - Content)
The benefit here is it's automatically generated so we don't need to manually keep it up to date.
Yes,
toc: true/false
should be respected.The condition on the word count set in my example (400) is optional - but I like it because it does not force add a ToC if the post is too short and contains only 1 or 2 headings.
You can test this locally with the gitea docs and see which pages are omitted.
Correct. And I would try to avoid including semi-automatic approaches tied to an editor plugin (even though I use such for myself). Hugo can do this.
I also think the style could be adjusted somewhere.
@pat-s would you mind to file a pull?
@6543 I see you went ahead already :) Do you continue there with CSS tweaks etc. or are you waiting for me?
@lafriks created a pul I just tested things
To move the ToC below
h1
we need to define a shortcode inlayouts/shortcode
and use it at the appropriate place in each post, e.g.See also this post.
This gives the ability to position the ToC anywhere and also modifiy it via it's own CSS class.
In addition in each post
toc: false
needs to be set to suppress the top-level ToC creation.Also ToC levels are only rendered starting from
h2
, so all posts would need to follow this rule.There are two possible locations for the new
toc.html
file:docs/layouts/shortcodes/toc.html
(contains aldready 4 other shortcodes)docs/themes/gitea/layouts/shortcodes/toc.html
(currently empty)I'd say it can be defined directly in the theme?
toc.html
:This then renders as follows
@techknowlogick I got a PR ready but cannot fork because "You cannot fork a repo you own". However I also do not have push rights to this repo.
Could you have a look?
so in this case we do not have to alter the theme, we just have to update the docs ... I'll file a pull
I'd say we should alter the theme as described above. And then file a pull with the required changes in
gitea/docs
.But it would be great if new contribs could at least fork this repo here :)
That's a bad error message (and probably just a side-effect of a template PR)
@pat-s You already have a fork, so that's why you got the
You cannot fork a repo you own
error. ?? oh, forget what I said ?
-> https://github.com/go-gitea/gitea/pull/13890
works nicely ...!