-
Notifications
You must be signed in to change notification settings - Fork 19
Support Next/Previous links #265
Comments
Finding chapter listsThis proposal means build-json needs a way to find chapter_list files. At the moment it doesn't need this because they are always pointed to by something else (sidebar and landing page specifications). But in this proposal they are not. It seems like the implementation needs to go something like:
At the moment chapter lists are just scattered through the tree in what seem like relevant locations (for example, the chapter list for HTML guides is in the parent folder for the HTML guide pages). Although they do have a special format, they don't contain any metadata saying what they are. So I can think of a few approaches:
Unless we wanted to dig into (4), then I'd favour (3). |
Scraping chapter listsIt's going to be tricky to scrape documents that use Next/Previous into the model proposed here, because the Wiki docs don't provide enough information for the scraper to build sensible chapter lists. Perhaps we could:
The next step to explore this option would be to get a sense of how many chapter lists there might be. We could have some help to construct them (for example, GroupData.json includes an optional "guides" section for each API, which should just map directly to a chapter list). |
Nice writeup Will! A few points/questions:
|
Seems like a similar problem to examples. We need a way to distinguish between types of content that aren't pages (different kinds of examples, chapter lists, who knows what else in the future). I don't have a solution to this problem, but I'm not sure dismissing option 2 makes this confusing thing actual go away. |
I didn't really explain how this might work for "Overview" pages. In the current implementation, chapter lists don't actually have the concept of an overview page, but this "Overview/Next/Previous" use case makes me think that they should. I'm not sure if overview pages should be an optional element in a chapter list or a mandatory element. So, I think that if a page is in a chapter list, and that chapter list includes an overview page, then build-json will add an "overview_page" link into the JSON that it builds for the page. Then the renderer can render this as a link like "^Overview" or whatever.
That makes sense.
Yes, but this would be very specific to the particular chapter list, and wouldn't generalize to other areas such as the JS guide or the Games stuff, or...
To me it's a little different from examples. The problem with examples is knowing which sort of example an example file contains (executable or static), which feels like a problem contained within the code-examples domain, so I'm more comfortable with a specific solution. The problem here is knowing that a given YAML file is a chapter list at all and not something completely different. That feels like a more generic problem, so tacking on a specific solution feels more sketchy. |
I think in most cases, it makes sense to have an overview page, even if it's just a collection of links to group the members of the list together. It'd be interesting to have a think about cases where we don't have overview pages, and if that's ok, or even desired?
Yeah, good point. |
This really sounds great so far. I agree that having the ability to create an overview page, ideally with some introductory text but at least a table of contents of the pages within, would be useful. I suspect also that there are many places we should be using pagination buttons like this where we are not. |
In MDN writers want to link together pages that are presented as a linear sequence of chapters, typically by providing "<< Previous" and "Next >>" (and sometimes "^ Overview") links.
This basic feature is reimplemented independently by three groups of KS macros:
Next
,PreviousNext
,Previous
: used by various sets of pages including the JS guide and Games docsNextMenu
,PreviousMenuNext
,PreviousMenu
: used by the Learn docsnextPage
,previousPage
: used by no en-US pages, and a hundred or so outdated pages in other localesThe table below summarises how many pages use these macros:
The bulk of them are translations of the Learn area, which seems like important content.
Assuming this is a feature we want to support in stumptown, the obvious suggestion is to use the "chapter_list" feature which we already have. This feature enables writers to say that a collection of pages live together and should be presented in a particular order. They do this by providing a special YAML file listing the pages, like this: https://github.com/mdn/stumptown-content/blob/master/content/en-US/html/guides/Guides.yaml.
Currently these things are used in landing pages and sidebars. We could use them for Next/Previous, like this:
next_page
andprevious_page
to the JSON for the page.next_page
andprevious_page
items, and adds the appropriate navigation elementsThis seems nicely coherent with the other uses for chapter lists, and means authors get next/previous for free, without having to do anything else. And it makes a nice split between content and rendering: writers don't have to decide how next and previous should be rendered, they just say what they should be.
This does imply that a page can only belong to one chapter list, which seems reasonable.
Acceptance criteria
The build-json code adds "Next" and "Previous" links to pages that are included in a chapter list.
If the chapter list also includes an "Overview" link, then the build-json code adds that, too.
The text was updated successfully, but these errors were encountered: