facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.6k stars 8.5k forks source link

Add warning banner for outdated docs versions #1283

Closed thibaudcolas closed 5 years ago

thibaudcolas commented 5 years ago

🚀 Feature

A feature I miss from other tech docs builders that support versioning is the ability to show a banner on older versions, to redirect people to newer docs.

Have you read the Contributing Guidelines on issues?

Yes

Motivation

For versioned documentation, it’s quite common for links pointing at docs to reference a specific version, or for a specific version to get indexed in search engines. This can be problematic once a version isn't supported anymore / once a newer version is available, because users of the docs might not realise they are looking at outdated information.

Pitch

This feature should be implemented to reduce the likelihood of docs users wasting their time looking at an old version of the docs, where they arrive to the docs from a link pointing at a specific version. Here are examples of docs that use a similar pattern:

django-top-banner
wagtail-top-banner

Finally, this is a different feature but Django also has a similar banner for the development / latest docs, https://docs.djangoproject.com/en/dev/:

django-dev-top-banner
tusharf5 commented 5 years ago

@endiliey I would like to take this up. Please assign it to me if no one is already working on it. I've already made a rough implementation and it is working.

Few things I want to ask regarding this

endiliey commented 5 years ago

@tusharf5 let's talk about the API first.

How do user set if certain version is outdated ? Can they decide if certain link is outdated ?

The announcement bar feature can be somewhat general feature too,, not just for outdated docs. Sometimes you want to announce something in your website. For example: “We are looking to revamp our docs, please fill this survey”. Even better if the announcement bar is dismissable and render above the nav bar.

any opinion @yangshun @JoelMarcey ?

tusharf5 commented 5 years ago

How do user set if certain version is outdated ? Can they decide if certain link is outdated ?

At first, I was just thinking of showing an announcement bar if the current version is not the latest. But if we want the user to set if a certain version is outdated or beta or something else. I think versions.json could be a good place. Something like

[
  "1.10.0",
  "1.9.0",
  "1.8.1",
  { 
     version: "1.7.x", 
     deprecated: true, 
     message: "This version has a security bug",  
     ...other attributes 
  },
  "1.6.x"
]

The announcement bar feature can be somewhat general feature too, not just for outdated docs.

Yes (something like a global modal component), and depending upon the announcement type (info, alert, notice) we could change the appearance a little.

I have a very little idea of the project structure and internals so I don't know how complex this would be or if it would make any sense at all.

yangshun commented 5 years ago

I don't really like the idea of bloating versions.json with more fields. Mixing types in an array is usually not a good idea also (we'll take in strings and objects)

I don't think we should pursue this currently for the following reasons: