-
Notifications
You must be signed in to change notification settings - Fork 501
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
feat(macros): rewrite SVG sidebar #8289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a content perspective
@wbamberg Let's use the PR template whenever possible, and add before/after screenshots whenever the UI changes. 😉 |
Sorry. Updated. |
Yes, this is much better than what we have. FWIW IMO it would be better if the structure were defined in mdn/content data - e.g. tutorial etc. rather than headings and content being in yari. Generally it would be nice to never have to go near yari. |
Thanks Hamish! We just talked about this but ftr: @caugner and I talked about exploring a future for sidebars where they are specified by writers in JSON and built by Yari. I'm going to use this PR #8132 to explore that idea. If you look at the sidebar there, it's basically in three pieces:
We could also imagine a JSON file in https://github.com/mdn/content/tree/main/files/jsondata that maps directories (and maybe page types) to sidebars. Then Yari could auto-add the correct sidebar to each page, and we wouldn't need the KS calls in content at all any more. There are a lot of details to work out and some sidebars that would be hard to accommodate (like DefaultAPISidebar). But this is the general idea. |
@wbamberg ^^^ That is a promising thing to hear. I sounds like we are very aligned. My thinking is that in the ideal world you could specify a sidebar like {{Sidebar("link to json file name "or some alias for it that is defined somewhere")}}. The sidebar would then be built on that definition. So just one macro "under the hood" for any sidebar. |
Ideally we would simply show the sidebar that references the page, and avoid that a page is referenced in multiple sidebars (so that, if a user clicks on a link in a sidebar, the resulting page will have the same sidebar). |
This pull request has merge conflicts that must be resolved before it can be merged. |
@caugner In most sites that would be true, but in MDN the ability for pages to appear in different sidebars is a "feature". For example, consider |
BTW, what has to happen to get this PR in? |
Yeah, this would be hard in our current IA. See also, Learn content, which is duplicated in domain-specific areas. For the medium term (say the next three years) I would be totally happy with a map in /jsondata that says things like:
I think that would work fine, and would avoid the worst problem, which is that authors have to add |
Agree ^^^. What needs to happen to get this PR in? |
Summary
This PR rewrites the current SVG sidebar, SVGRef.ejs.
Problem
The immediate reason for this is that the current sidebar uses tags, and we want to stop using tags.
But the current sidebar is also not very useful: it only lists elements, not attributes or any guide/tutorial content.
Solution
This sidebar is more or less modelled on the partly-new HTML sidebar, since the domain has a similar structure:
Some notes and things.
Screenshots
Before
collapsed:
expanded:
After
collapsed:
expanded:
Testing
Testing: fire up yarn dev and visit:
Fixes #7171.
@teoli2003 , @hamishwillee