Replies: 0 comments 12 replies
-
One of the genuinely cool things that Stumptown "invented" was the fresh simplicity. As a "purer" data structure, without weird hacks and quirks, sidebars become a lot easier to maintain and extend. And from a user-point of view, it helps to navigate and consume the site if sidebars behave and look like you're expecting them too. When some sidebars are very different, it forces the brain to parse a new format that you might not be used to. We can start slowly and build up exactly what we need. For example, we might want extra stuff beyond just |
Beta Was this translation helpful? Give feedback.
-
Usually, the logic for something to appear in the sidebars is either by looking through document tags, or alphabetical order, or perhaps a curated sort order. Sidebars are a content-writers domain but I think it should be as simple as picking a named style or simply jotting down a specific order. Computers can do the rest. |
Beta Was this translation helpful? Give feedback.
-
You're showing a nested example in your code snippet. Would it need to be that way? (As in: breadcrumbs) |
Beta Was this translation helpful? Give feedback.
-
It may be a good idea until they ask us for a series of customizations such as icons, colors, particular behaviors. But until then it's definitely okay to model better and in JSON definitely. One thing I've seen Java folks do is use XML which is more extensible for a variety of reasons. At first it seemed stupid to save data in XML but it has its advantages because you can create custom names like in JSON but in addition you have the descendancy relationship (element that contains 1 or more elements, instead in JSON you can create a children key but it is tiring to manage, you see the DOM as it is complex). |
Beta Was this translation helpful? Give feedback.
-
@escattone and I chatted about this offline (email) and basically concluded that we don't need to anything with this right now. We'll just leave it as a prototype. |
Beta Was this translation helpful? Give feedback.
-
I think that if possible the data should be only in the pages and in the BCD and as much as possible the other components should be the result of computation between 5 sources that are:
|
Beta Was this translation helpful? Give feedback.
-
I'm not sure how we define a sidebar in this model. Is it just a JSON object? If so I think it would be hard to maintain this kind of sidebar. With our sidebars we often want to say something like: "under here, list all the object's properties in alphabetical order" (which translates to "list all the subpages of this page that have a 'Property' tag") and it would be nice to be able to do this without explicitly listing every property page in the sidebar specification, otherwise we have to remember to update the list when property pages are added/removed. So the strength of KS is that it's able to do these kinds of quite powerful things. On the other hand:
It would be great to invent a syntax that's just expressive enough for our uses but simple enough for the heavy lifting to be done in common code that's properly maintained. This is where I was trying to get to with mdn/stumptown-content#302. I don't really know if this is practical though. Either way though, we should treat sidebars as a content design problem first. That is, before deciding how we would like to implement sidebars, decide which different sidebars we should have and what they should contain. Because I think only by doing that can we know that a particular implementation can support the sidebars we want. That's how I went about it when we were thinking of how to do JS sidebars in stumptown. At the moment, some of our KS sidebar macros produce pretty good sidebars, and some don't: for example, the CSS sidebar. But the usability problems with the CSS sidebar are not the fault of KS. |
Beta Was this translation helpful? Give feedback.
-
I've started tracking my experimentation in this PR: mdn/yari#3928 |
Beta Was this translation helpful? Give feedback.
-
In Stumptown we wanted to get away from KumaScript rendered blobs of cryptic macro code. Instead, the sidebar would just be an (infinitely deep) array of arrays. As simple as:
Today, in about an hour's worth of work I put together a working prototype of this in Yari.
The idea is that you do this to the content: https://gist.github.com/peterbe/321aba029edcafb47639e9024e621cef
And the business logic that implements this won't be KumaScript ejs but instead pure Node JS code. This means it's really easy to code on (Prettier, syntax highlighting, caching, unit testing) and hopefully a lot more performant too since it's so simple instead of building.
Also, when shipped as part of the document state, it's just an array of objects rather than a fully encoded blob of HTML.
So it'll load faster. And we can potentially do more things that were hard in KumaScript. For example, instead of hardcoding things we can reach out to Yari APIs to get sorted lists based on traversing the filesystem.
It's just an experiment and I'm doing it carefully and gradually. It degrates to a fallback of the old KumaScript HTML sidebar macros if the content hasn't been updated.
There's definitely some work left on the rendering part so that it displays exactly like we want it to.
Here's what the prototype looks like:
Code here: mdn/yari@mdn:master...peterbe:related_content-experiment
Beta Was this translation helpful? Give feedback.
All reactions