docus icon indicating copy to clipboard operation
docus copied to clipboard

[Bug] navigation.redirect usage in _dir.yml

Open arkhaiel opened this issue 2 years ago • 2 comments

Hello there,

I'm not sure if it's a bug or a bad usage, but I can't setup a proper redirect. In subfolderA/0.index.md :

---
redirect: /subfolderA/subfolderB/page
---

With npm run dev everything works fine, when I go to /subfolderA I'm redirected to subfolderA/subfolderB/page, but when I run npm run generate then npm run preview (or upload on netlify), the redirection doesn't work anymore, and I have a 404 error.

I can see in the dist/public/subfolderA directory there's no index file, that would explain the 404 error, but why ? How should I do ?

Is there something I don't understand, or is it a bug ? While searching in the issues I discovered another one which is related, posted by... me. (https://github.com/nuxt-themes/docus/issues/749) but nobody answered. I'm surprised nobody else posted an issue, anyway I'm till trying to redirect !

Thanks

{
  "name": "docus-starter",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "nuxi dev",
    "build": "nuxi build",
    "generate": "nuxi generate",
    "preview": "nuxi preview",
    "lint": "eslint ."
  },
  "devDependencies": {
    "@nuxt-themes/docus": "^1.10.1",
    "nuxt": "^3.4.1",
    "rehype-katex": "^6.0.2",
    "remark-math": "^5.1.1"
  },
  "dependencies": {
    "nuxt-content-assets": "^1.3.2"
  }
}

arkhaiel avatar May 03 '23 20:05 arkhaiel

By doing further research, I can see :

  • the docus website uses navigation.redirect in a _dir.yml file (but navigation.redirect is not mentioned in the docs ?), and it works if you also install follow-redirects package ?
  • every link pointing to the folder containing the _dir.yml file results in a 404 error

Is it possible to actually use the redirect option as told in the docs, or is it a deprecated thing ?

arkhaiel avatar May 03 '23 20:05 arkhaiel

You should still be able to use navigation.redirect!

_dir.yml will never be considered as a page, but instead allows you to configure a directory and his childs behavior.

Tahul avatar May 17 '23 14:05 Tahul