Repository navigation
Is it possible to have the same document render different content based on the url link? #9187
Replies: 1 comment 6 replies
|
I'm not an SEO expert but what I understand is that Google is able to index content in tabs and accordions when it's "done properly" (not sure yet what this means). I can't tell if it would work with a less-standard setup of toggles, and even wonder how the VueJS site implements this and if it even works as you would want it to? How did they implement that exactly, and does it work well in practice? ---
title: Hello world
---
import {When} from './when'
This is some shared _markdown_
<When myToggle={true}>
This text is visible only when "myToggle" is enabled
</When>
<When myToggle={false}>
If myToggle is disabled, we instead see this text
</When>This is not clear to me how that boolean condition is actually updated. I assume in practice it's dynamic and the way it's toggled probably matters a lot for SEO. Regarding the TOC, considering our HTML pages are static and support progressive enhancement, the TOC should also be static and work well before JS loads/runs, so we can't have a "dynamic TOC" easily without introducing hydration layout shifts. Related to #8764 I'm not sure if it's what you want but I think it could be better if one doc would be able to be rendered into 2 distinct pages (with different URL pathnames like Related issues:
You might also find useful to remove/hide sections thanks to a remark plugin: #6201 (comment) |
Uh oh!
There was an error while loading. Please reload this page.
Hello!
My documentation uses a pattern similar to that of VueJS's website, where the docs have toggles to enable/disable certain features.
This slightly changes the content of the articles (such as changing code snippets).
The challenge I'm currently facing is that I want it to:
For reference, at the moment I write my docs as follows:
This approach works great for me in terms of maintainability. But it breaks the sidebar/SEO and content table (if a heading is only conditionally enabled, it always shows up in the content table even if disabled).
I could have two markdown files. But then I would have to duplicate the frontmatter & the
This is some shared _markdown_text (which usually is the largest part of documents)Are you aware of a possible solution that wouldn't involve duplication while also fixing those SEO/searchbar/content table issues?
All reactions