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
recursive navigation #192
base: main
Are you sure you want to change the base?
recursive navigation #192
Conversation
adds whitespace trimming to loop
I just noticed something strange, btw. |
don't print sub-menu unless active
…uld be done, perhaps, with a separate config.
no need to reset active unless set
removes line breaks from assignment
Thanks for this -- going to do some testing on it this week. |
Although the current 3-level navigation is adequate for my current projects, recursive navigation seems to be simpler to specify, as well as more general. If this PR gets included in the next release, I'll be happy to drop #188.
Presumably existing sites that use those options will still work OK? I've created a small project to test and demonstrate the effect of PR #188: https://pdmosses.github.io/test-nav/ . It has 3 levels of navigation, and uses a new config option Assuming that recursive navigation automatically gives the same effect as |
This pull request maintains full backwards compatibility, it just simplifies things and fixes a few bugs.
Do you want grandchildren to be also rendered with It can certainly be done, but I feel that it is a feature that probably needs further discussion and approval of @pmarsceill. |
Right -- but that is slightly different from the current behaviour. PR #188 includes restriction of the displayed navigation to direct children, as suggested in #173. For backwards compatibility, however, this is activated by a config option ( I don't personally have a use-case for displaying grandchildren. In fact the restriction of the display to direct children is essential for my main project. |
I think the current behavior must have been a bug then, since it is not documented (and I followed the documentation). |
@pmarsceill |
@pmarsceill |
adds trailing line break
…iquid plugins for security reasons
Since this is a "breaking" change -- I'm going plan for it to be included in the |
The changes in this PR address also issue #173. I've tested them in https://pdmosses.github.io/test-nav/ and I'm happy with the resulting behaviour. I look forward to exploiting deeper navigation on other sites. |
@thealjey, I've experimented with using the files from Before adding the changed files, the local build time for the site was 25 to 30 seconds. After adding them (without altering the navigation hierarchy or the YAML data) it is more than 500 seconds! Moreover, after making a trivial change in one file ( The navigation in the local built site looks fine. However, I'd prefer the build time to be lower, so I haven't pushed the changes to GitHub. Looking at the liquid code in BTW, I tried removing the nested sorting at the start of |
@pmarsceill bringing |
The And personally, I don't want to have to update any fields on a large site unless it's essential. |
@pdmosses yes, but if the id itself was optional and defaulted to the value of title, |
@thealjey I don't see the disadvantage of continuing to use the I agree that an optional |
Layout changed to use recursive navigation code from just-the-docs#192. Nav links, crumbs, and TOCs display OK for unique titles. Expanders not yet added.
@thealjey I have added a branch https://github.com/pdmosses/just-the-docs/tree/rec-nav-0.3.0 to my fork of JtD. I created it based on the 0.3.0 master, then replaced the navigation by your code, with very few changes. The navigation is currently based entirely on I have not submitted a PR based on my rec-nav-0.3.0 branch, since it is essentially just an update of the present PR to work with 0.3.0 - I haven't added any new code at all. If you have time, could you copy the changed files to your PR, so that we can proceed to review it?
I'll now proceed with trying to implement that idea. |
It turned out to be simpler to filter the groups when needed, rather than splitting the groups in The updated code now gives the correct navigation for the pages in Testing: the displayed children of the C child of A don't include the children of the C child of B, and vice versa. I'll now try using my rec-nav-0.3.0 on a larger site, to check the build efficiency. |
By using Where I'm using just the docs, we're trying to standardize pages and subpages for easy reading (e.g. all docs for microservices have the same format and same child page names). |
@mikeecb my aim with using
I would also like to support that kind of navigation (which isn't available in 0.3.0). To disambiguate navigation for pages having identical titles in different sections of a website, one could include a distinguishing prefix in all the titles; but that is clearly not a good solution. Something equivalent to such a prefix could be included in the front matter of the pages, and not appear in the titles. My initial idea was to specify as much of the ancestor path as needed for disambiguation. An optional However, what all the pages for a particular section of a website have in common is the node at the top of that section (which need not be at the top of the entire site, of course). Those section top nodes naturally have different titles. So for disambiguation, it would be adequate to specify the
(Changing a section title would involve updating the same string in the Would that be an adequate solution for your sites? |
@pdmosses I've made an alternative implementation to recurse pages without the need to add anything to front-matter. You can see the implementation details here: https://github.com/Potherca/extend-the-docs/tree/HEAD_includes/nav_recurse Cleanup is still needed and I haven't looked at speed optimizations yet, but I thought it might be of interest to you... |
@Potherca, to base the navigation entirely on the URL path hierarchy surely has some advantages – especially in connection with this recursive navigation feature. And I guess that in many sites using Just the Docs, the URL path hierarchy does correspond closely to the navigation structure. However, the names in URLs are sometimes quite cryptic abbreviations, which makes them unattractive for general use in navigation, I think. BTW, you have a navigation expander on your extend-the-docs link, but it doesn't seem to do anything when clicked. |
I completely agree, that's why I only use the URL/path for folders that have no readme (so no way to get a title) or pages that do not have a title (which are not supported by Just the Docs).1 I'm still thinking about the best way to deal with those scenarios. 2 If I manage to get my changes stable and performant, it might be worth seeing if they can be ported back into Just the Docs. The main reason for "going solo" is that I am not familiar enough with the community and I don't want to frustrate any existing efforts.
Good catch! Looks like I have a bug to fix. 😹 Footnotes
|
@mikeecb @Potherca I've now added a branch with a new implementation of recursive navigation: https://github.com/pdmosses/just-the-docs/tree/rec-nav The previous branch (reg-nav-0.3.0) was a merge of @thealjey's implementation and JTD-0.3.0, with the addition of
Could you take a look at it, and let me know whether it addresses at least some of your concerns regarding my previous proposals? Regarding efficiency, the build time appears to scale somewhat better than the previous version. Testing locally with a real site of 150 pages (mostly included in the navigation, 4 levels) using Jekyll-3.8.7 with profiling on a MacBook Air (1.6 GHz Dual-Core Intel Core i5) I get the following approximate times for clean builds of subsets of pages:
With Jekyll-4 the build times should be significantly faster. But before proceeding, it would be good to check scaling to larger sites. BTW, it appears that the (nice!) navigation expander feature introduced by @SgtSilvio requires all pages to include the entire navigation hierarchy, which can be quite big on larger sites; in previous releases, only the part of it visible on the page was needed. I've added an option to hide the expanders and reduce the amount of code for navigation. |
With Jekyll 4.1.1, the builds are a bit faster for both versions (the total times below are the average for two clean builds):
The profiling reports the number of times each file is included and the time that takes, indicating where significant optimisation might be possible. For instance, when building 152 pages in the previous branch (rec-nav-0.3.0), It appears that (for both versions) the build time complexity is roughly quadratic in the number of pages included in the navigation. The navigation hierarchy of the profiled website isn't exceptionally deep or wide: the number of pages is consistent with an average depth 3 and average width 5. Should we be concerned about such build times? Are users with somewhat larger sites likely to get timeout errors when building on GitHub Pages? |
BTW, setting
I've added an overview of the implementation in https://github.com/pdmosses/just-the-docs/blob/rec-nav/docs/test/about.md (Updated) Site Render Stats reported by Jekyll:
The reported CPU times vary somewhat between (clean) builds. The improvements over the previous version of the above table are due to adding heuristics that can locate pages quicker in the navigation hierarchy. |
I decided to convert the Git page into subpages. The downside is that Just the Docs does not currently support more than 3 subpages deep. I guess we'll have to wait for just-the-docs/just-the-docs#192 to be merged
Any status on this 🙌 |
@kdvtrifork apologies for the delay. Please take a look at PR #462, which can also be used for further discussion of points raised in various comments above. |
I ended up creating a 11ty version of a recursive just-the-docs template. you can see what it looks like here this template my bigger project, dendron, an open source note note taking tool built on top of vscode and markdown with static publishing capabilities. posting here in case it helps anyone with recursive navigation. feedback also appreciated :) |
@kevinslin thanks for the post. You wrote:
This PR has been superseded by #462, for various reasons. Are there significant differences between the features you have implemented on your site and those implemented by #462?
Feedback on #462 is welcome too! |
Yeah, I would say the main difference is that Dendron went the ID route.
Each note has a unique guid at the top (frontmatter) and then written with
the guid when compiled. See
https://dendron.so/notes/5fcb8564-7209-4a80-9bb8-025bc8eb489b.html#permanent-ids
…On Sat, Jan 16, 2021 at 2:23 PM Peter Mosses ***@***.***> wrote:
@kevinslin <https://github.com/kevinslin> thanks for the post. You wrote:
posting here in case it helps anyone with recursive navigation.
This PR has been superseded by #462
<#462>, for various
reasons
<https://github.com/pdmosses/just-the-docs/blob/rec-nav-2/_tests/navigation/recursion/about.md>.
Are there significant differences between the features you have implemented
on your site and those implemented by #462
<#462>?
feedback also appreciated :)
Feedback on #462 <#462>
is welcome too!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADD52PJBOM47N4K6YJQ2L3S2IGWHANCNFSM4IMOV4GA>
.
|
Right, that's indeed a major difference. For parent title disambiguation, #462 allows (globally-unique) section IDs in front matter, but they do not affect the URLs of pages. Jekyll's permalink feature can be used to make URLs independent of file names, when needed. |
Hello, I am interested in not having a limitation of levels in the navigation tree. Where can I find the modified content with a more current version of just-the-docs? Thank |
has_children
andgrand_parent
options are removed as unnecessarynav_exclude
excludes the page from any depth in the menu hierarchy