Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 多语言 404 页面默认只生效默认语言 #277

Closed
Mejituu opened this issue Jan 29, 2023 · 2 comments
Closed

[BUG] 多语言 404 页面默认只生效默认语言 #277

Mejituu opened this issue Jan 29, 2023 · 2 comments
Labels
Q&A question and answer

Comments

@Mejituu
Copy link
Contributor

Mejituu commented Jan 29, 2023

Describe the bug 描述你遇到的错误

在多语言 404 页面默认只生效默认语言,比如我有俩个语言 zh-cn en,在404情况下只会显示默认语言的404.html,也就是/404.html

Expected behavior 期待的行为

在默认语言下 404 -> /404.html
在不是默认语言下 404 -> /languageCode/404.html

Screenshots 屏幕截图

No response

Build Environment 构建环境

hugo 109 or 110

Preview Environment 预览环境

Debian testing KDE

Additional Information 补充信息

No response

@Mejituu Mejituu added the bug Something isn't working label Jan 29, 2023
@Mejituu
Copy link
Contributor Author

Mejituu commented Jan 29, 2023

文件是存在的,但是不会根据语言切换404文件,导致在不是默认语言且是404情况下,显示的与选择的语言不相关(包括菜单等等)

@Lruihao
Copy link
Member

Lruihao commented Nov 17, 2023

这个问题属于服务器部署相关的问题了,例如:

  1. Netlify 部署可以配置 _redirects 文件

    /zh-cn/* /zh-cn/ 404.html 404
    
  2. Vercel 部署,详见 Custom 404 Page

{
  "routes": [
    {
      "handle": "filesystem"
    },
    {
      "src": "/zh-cn/(.*)",
      "status": 404,
      "dest": "/zh-cn/404.html"
    },
    {
      "src": "/(.*)",
      "status": 404,
      "dest": "/404.html"
    }
  ]
}
  1. hugo 开发模式(hugo server),详见 Configure server
[[redirects]]
  from = '/zh-cn/**'
  status = 404
  to = '/zh-cn/404.html'
[[redirects]]
  from = '/**'
  status = 404
  to = '/404.html'

Lruihao added a commit that referenced this issue Nov 17, 2023
@Lruihao Lruihao added Q&A question and answer and removed bug Something isn't working labels Nov 17, 2023
@Lruihao Lruihao closed this as completed Nov 17, 2023
Lruihao added a commit that referenced this issue Nov 29, 2023
* v0.2.18-lts: (22 commits)
  🔖 Chore(release): 0.2.18-lts.5
  📝 Docs: update chang log and docs
  🔧 Chore: change the theme minimum supported Hugo versions above **0.110.0**
  🔧 Chore: update default config in `hugo.toml`
  🐛 Fix: active index of toc may result in error
  ✨ Feat: add hiddenFromRss param and front matter
  ⚡ Perf: preload some stylesheet
  🔧 Chore: add Vercel config (#277)
  🐛 Fix: fix logic error of  lightgallery images rendering
  📝 Docs: update the outputs configuration to avoid the following warnings in versions above Hugo 0.112.0 (resolve #354)
  📝 Docs: update content license
  🐛 Style: fix the emoji style of valine comment (resolve #376)
  ⚡ Perf: optimize featured image rendering
  🔧 Chore: add decoding and referrerpolicy options for img plugin
  🚸 Feat: change bilibili shortcode `muted` default value
  🔖 Chore(release): 0.2.18-lts.4
  📝 Docs: update change log for v0
  ✨ Feat: add more options support for bilibili shortcode, e.g. `autoplay`, `muted` etc. (resolve #375)
  🐛 Fix: disable encrypted articles from rendering to rss (fixed #374)
  🐛 Fix: fix featured image path error in rss and show img tags in rss
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Q&A question and answer
Projects
None yet
Development

No branches or pull requests

2 participants