Replies: 1 comment
-
Through further reading, I've found an example under Dynamic Routes that looks to represent one method of achieving the navigational experience of what I'm after. https://vitepress.dev/guide/routing#dynamic-routes //https://vitepress.dev/guide/routing#paths-loader-file
// docs\shapes\[square].md
// docs\shapes\[square].paths.js
//[square].paths.js
export default {
paths() {
return [
{ params: { square: "square" } },
{ params: { square: "large-square" } },
{ params: { square: "rectangle" } },
];
},
};
//Builds the following;
//http://.../shapes/square.html
//http://.../shapes/large-square.html
//http://.../shapes/rectangle.html For my example at least, I'm not sure if I'm comfortable with the idea of duplicating the same article again and again just to achieve a navigational experience - and how these duplicate articles will pan out in the bigger scheme of things. Keen to hear if other devs are achieving similar Sidebar Navigational experiences but by using different methods (without article duplication). PS: I'm well aware that a square is a rectangle and that the reverse is not true. I'll think of a better example for my next question. 😉 |
Beta Was this translation helpful? Give feedback.
-
With this sample config.js, I'm needing the behaviour so that when the end user navigates to Shapes then clicks "Rectangle" in the sidebar, they're then taken to the Square page.
The problem I have is, I just can't have rectangle directly linking square because then sidebar lights up all the matching links that are active (both Rectangle and Square highlight). In my real world case, there's many (not just one) links in various sidebar locations, some are nested, and the sidebar essentially becomes confusing to the end user as all the text entries of the same link activate.
I thought rewrite feature might be what I needed, but after testing, I don't think it is;
With this, I was hoping the URL would perhaps continue to read /shapes/rectangle, whist serving /shapes/square content.
Appreciate any help on this!
Beta Was this translation helpful? Give feedback.
All reactions