Feature: SEO- and user-friendly table of contents#124
Feature: SEO- and user-friendly table of contents#124sjorek wants to merge 11 commits intonevir:masterfrom
Conversation
Conflicts: lib/styles/default/behavior.coffee lib/styles/default/style.css
|
@kmdavis … I think I'll close this pull-request due to the lack of interest and more importantly, its bad design and behavior. Any objections ? |
|
I wouldn't say there's lack of interest. I was planning to take a more detailed look at this next week. However, based on the description, I'd probably push for a purely ajax solution, as this would dovetail nicely with work I had planned for Gilt's internal documentation server. Here at Gilt we have hundreds of ui modules, and we run groc on each of them individually, but we'd like the search function to search all of the modules -- which would require either an ajax search/toc or our server could rewrite the search data on request. |
|
Although one might think the following notes are a bit off-topic, it is actually related to the initial motivation behind the SEO-friendly TOC. @kmdavis I also have your comments about your gilt-setup with ajax and search in mind: Has anyone (especially @kmdavis) ever thought about splitting groc into a client (rendering the html-docs) and a service delivering the (pre-parsed) sources? I know many of you want to get rid of the pygments dependency, and with the current groc-design I certainly agree with all of you. On the other side the suggested client-service-design could finally satisfy all of our diverse needs. I try to explain why, and please don't get the following thoughts wrong, because I still talk a lot about python (:hear_no_evil: :see_no_evil: :speak_no_evil:): Using the pygments' formatter- und filter-api I created some plugins with I have some experience with python's excellent twisted-framework. Writing a simple JSON-REST-like-service that runs locally on top of the same sources as groc and spits out nice and easily consumable JSON for groc, should be easy. The logical next step would be a rewrite of this service in node.js and voilá a modular groc-achitecture would have been born. Pros:
Cons:
Do you get, what I have in mind, what I talk about ? Should I explain some thing more thoroughly ? Is anyone interested in working samples ? Btw. sorry, for writing that much again … 😊 |
As groc's incomplete google site-search results prove, the current on-the-fly generated tables of contents is ignored by search-engines.
As an initial step towards a better (ajax-based ?!?) solution I changed the implementation to generate the TOC directly in the jade-template
docPage.jadeand restructured thebehavior.coffeeaccordingly, hopefully without touching any existing functionality. This step made a split of the single-phase groc-process into a 2-phase groc-process necessary. As before phase 1 reads and parses all sources files to collect this information, but it does not render the jade-template yet. After this phase the TOC's data is generated from the infos collected as before. Now starting with phase 2 all the sources files from phase 1 will be rendered, but this time having the TOC's data in their context.Other changes introduced by this commit:
nav ol.toc li.selected-class an additionally classnav ol.toc li.currenthas been introduced to permanently mark the current document..matched-class from TOC-items.