Can't remove deleted pages from search or "current" URL
See original GitHub issueš Bug Report
Have you read the Contributing Guidelines on issues?
Yes, I highly recommend them
To Reproduce
- Follow https://docusaurus.io/docs/en/installation to make a new docusaurus v1 project
- cd website
- yarn examples versions
- yarn run version 1.0.0
- Delete docs/doc3.mdfile and delete"Second Category": ["doc3"]fromsidebars.json
- yarn run version 2.0.0
- yarn start
- View the website in a browser, and see that /docs/doc3still resolves to the version 1.0.0 file in a browser even though it doesnāt appear in the sidebar.
- If you can set up algolia, see that you can still get to the ācurrentā URL that way, too.
Expected and Actual behavior
When I delete a markdown file from the main docs folder and remove it from the sidebar, I would expect it to be inaccessible from the ācurrentā version.
But it continues to be returned by Algolia DocSearch, which can be clicked and the /docs/<id> does actually load correctly because of versioning fallback. This makes it appear as though that page still exists when it in fact does not.
Possible Solutions
Maybe the version command should be creating an empty markdown file in a versioned_docs folder for every file that is no longer in /docs?
Or maybe it can be solved manually with an array of doc IDs that should no longer be accessible?
Or if there isnāt a clear solution to the problem of the page being accessible, it should at least not appear in Algolia results so that nothing links to it.
Your Environment
- Docusaurus version used: 1.14.4
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0):
- Chrome 80.0.3987.132 (Official Build) (64-bit)
- Node 8
 
- Operating system and version (desktop or mobile): MacOS Catalina, desktop
Reproducible Demo
https://github.com/aldeed/docusaurus-versioning-issue
This repo followed the reproduction steps above so you only need to clone it, yarn install, and then start with the yarn start step.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)

 Top Related Medium Post
Top Related Medium Post Top Related StackOverflow Question
Top Related StackOverflow Question
Thanks @slorber. There are no pages to delete. The problem is the fallback behavior so fixing it would involve deleting pages from previous versions, which is not what we want. We DO want the pages visible when viewing an old version (which has them in TOC) but we DO NOT want them visible when you search the current version or go directly to that ID URL in the current version. Iāll see if I can figure out any easy way to circumvent the fallback from a list of IDs.
EDIT: Nevermind, I think I see what you are saying. Delete all the files/folders after the last version in which the content was correct. That would work, but itās quite a lot to delete. Need to delete from every subsequent version plus the current. If I can figure out how to not generate those in the first place, that will be a much quicker build.
@yangshun @slorber I have a PR with a possible solution that works well for me. https://github.com/facebook/docusaurus/pull/2955