HiDeoo / starlight-blog

Starlight plugin to add a blog to your documentation
https://starlight-blog-docs.vercel.app
MIT License
106 stars 10 forks source link

Next/Prev are opposite of what you would expect #25

Closed brettstack closed 2 months ago

brettstack commented 4 months ago

Is your feature request related to a problem?

The native Next/Prev of Starlight makes sense for docs where you're moving to the next article in the documentation. But for docs you would expect Next to go to the next most recent blog post (i.e up the left nav, not down left nav).

This would also improve support for blog posts in a series (e.g. if I post a series of 3 posts, I can publish them one day apart, and then clicking Next would go to the next post in the series).

Describe the solution you'd like

A isNextPrevChronological flag that defaults to true

Describe alternatives you've considered

No response

Additional Context

https://codegenie.codes/blog/aws-cognito-user-pools-sign-in-with-email-google-saml--and-link-to-a-single-user/

HiDeoo commented 3 months ago

Thanks for your feedback.

This seems to be a tricky topic. I just did a bit of exploration and I can find as many blogs using the current ordering as those using the proposed ordering so this is not really helpful.

The WordPress documentation defines this ambiguous behavior pretty well:

since weblog posts are traditionally listed in reverse chronological order (with most recent posts at the top), there is some ambiguity in the definition of “next page”

Altho, the current order follows the Wordpress definition:

WordPress defines “next page” as the “next page toward the past“.

Considering all this, I think we could indeed add an option to control this behavior. I'd like to avoid the boolean option so I'm leaning towards something like:

type NextPostLinkOrder = 'chronological' | 'reverse-chronological';

Still needs to think about the naming a bit more but I think this should be a good enough solution. The default value will preserve the current behavior.

Does this sound good to you?

brettstack commented 3 months ago

Love it! Thanks for doing the research.

newbeelearn commented 3 months ago

my suggestion is to add related content instead of prev/next. It can be based on tags/categories/keywords. That would be more useful to the reader rather than prev/next.

HiDeoo commented 2 months ago

Version 0.6.0 now includes a prevNextLinksOrder option defaulting to 'reverse-chronological'.

By default, next links will point to the next blog post towards the past ('reverse-chronological'). Setting this option to 'chronological' will make next links point to the next blog post towards the future.

brettstack commented 2 months ago

Legend!