hexo-theme-aurora icon indicating copy to clipboard operation
hexo-theme-aurora copied to clipboard

在查看文章页面时,一旦刷新,就显示404

Open 321paranoiawhy opened this issue 2 years ago • 2 comments

chrome和firefox下都存在这一问题,只要在文章页面点击刷新就会显示404

321paranoiawhy avatar Mar 24 '22 16:03 321paranoiawhy

@321paranoiawhy permalink 你配置了吗?https://aurora.tridiamond.tech/zh/guide/getting-started.html#%E6%AD%A5%E9%AA%A4-3-%E8%AE%BE%E7%BD%AE-permalink

bennyxguo avatar Apr 14 '22 02:04 bennyxguo

permalink应该设置为/post/:title而不是/post/:title.html,不然同样会404

idnewnil avatar Apr 27 '22 09:04 idnewnil

谢谢,已解决。抱歉,回复晚了。祝好。

Benny Guo @.***> 于 2022年4月14日周四 10:11写道:

@321paranoiawhy https://github.com/321paranoiawhy permalink 你配置了吗? https://aurora.tridiamond.tech/zh/guide/getting-started.html#%E6%AD%A5%E9%AA%A4-3-%E8%AE%BE%E7%BD%AE-permalink

— Reply to this email directly, view it on GitHub https://github.com/auroral-ui/hexo-theme-aurora/issues/185#issuecomment-1098640216, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYAGOBUL3ICGDLTMDQ3FYKLVE55FBANCNFSM5RRWNSZA . You are receiving this because you were mentioned.Message ID: @.***>

321paranoiawhy avatar Oct 11 '22 08:10 321paranoiawhy

permalink应该设置为/post/:title而不是/post/:title.html,不然同样会404 按照这个大佬的成功修复了,按照文档的 还是404 , 谢谢哈

YAOmeihah avatar Dec 06 '22 14:12 YAOmeihah

vue build的时候选择hash模式就不会有这个问题

Satoing avatar Jan 02 '23 12:01 Satoing

vue build的时候选择hash模式就不会有这个问题

Hash 模式 SEO 会相对比较差哦。

bennyxguo avatar Aug 04 '23 02:08 bennyxguo

一些服务器以及 Vercel 需要配置回退,参考 Vue 官方文档 腾讯云 COS 可以参考这个,同时把下面 错误文档响应码 改为 200

TTsdzb avatar Aug 04 '23 02:08 TTsdzb

一些服务器以及 Vercel 需要配置回退,参考 https://router.vuejs.org/zh/guide/essentials/history-mode.html

正解!:+1:

bennyxguo avatar Aug 04 '23 02:08 bennyxguo

自定义页面之间不发生跳转以及 about 页面再刷新404 bug #178 我查了查他让我这样做,但是我不知道怎么做才能让这个vercel.json保留在hexo -g生成的文件夹里面TAT Vercel 在项目根目录创建一个vercel.json文件,内容如下:

json { "rewrites": [{ "source": "/:path*", "destination": "/index.html" }] }

fffmath avatar Aug 05 '23 08:08 fffmath

自定义页面之间不发生跳转以及 about 页面再刷新404 bug #178 我查了查他让我这样做,但是我不知道怎么做才能让这个vercel.json保留在hexo -g生成的文件夹里面TAT Vercel 在项目根目录创建一个vercel.json文件,内容如下:

json { "rewrites": [{ "source": "/:path*", "destination": "/index.html" }] }

不需要在生成文件夹里,你把它放在项目根目录,Vercel会自己读取这个文件,试一下

TTsdzb avatar Aug 05 '23 08:08 TTsdzb

这么神奇玄学吗?!我的vercel对应的是我的github,但是我的github只有生成之后的那些文件,我觉得vercel接触不到这个文件呀,那我试一试

2023年8月5日 16:47,TTsdzb @.***> 写道:

自定义页面之间不发生跳转以及 about 页面再刷新404 bug #178 https://github.com/auroral-ui/hexo-theme-aurora/issues/178 我查了查他让我这样做,但是我不知道怎么做才能让这个vercel.json保留在hexo -g生成的文件夹里面TAT Vercel 在项目根目录创建一个vercel.json文件,内容如下:

json { "rewrites": [{ "source": "/:path*", "destination": "/index.html" }] }

不需要在生成文件夹里,你把它放在项目根目录,Vercel会自己读取这个文件,试一下

— Reply to this email directly, view it on GitHub https://github.com/auroral-ui/hexo-theme-aurora/issues/185#issuecomment-1666443848, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN66A5MCBSSWFT67OSHU3L3XTYCC5ANCNFSM5RRWNSZA. You are receiving this because you commented.

fffmath avatar Aug 05 '23 08:08 fffmath

不管用,请问你说的根目录就是和_config.yml并列的那个吗

2023年8月5日 16:47,TTsdzb @.***> 写道:

自定义页面之间不发生跳转以及 about 页面再刷新404 bug #178 https://github.com/auroral-ui/hexo-theme-aurora/issues/178 我查了查他让我这样做,但是我不知道怎么做才能让这个vercel.json保留在hexo -g生成的文件夹里面TAT Vercel 在项目根目录创建一个vercel.json文件,内容如下:

json { "rewrites": [{ "source": "/:path*", "destination": "/index.html" }] }

不需要在生成文件夹里,你把它放在项目根目录,Vercel会自己读取这个文件,试一下

— Reply to this email directly, view it on GitHub https://github.com/auroral-ui/hexo-theme-aurora/issues/185#issuecomment-1666443848, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN66A5MCBSSWFT67OSHU3L3XTYCC5ANCNFSM5RRWNSZA. You are receiving this because you commented.

fffmath avatar Aug 05 '23 08:08 fffmath

这么神奇玄学吗?!我的vercel对应的是我的github,但是我的github只有生成之后的那些文件,我觉得vercel接触不到这个文件呀,那我试一试 2023年8月5日 16:47,TTsdzb @.**> 写道: 自定义页面之间不发生跳转以及 about 页面再刷新404 bug #178 <#178> 我查了查他让我这样做,但是我不知道怎么做才能让这个vercel.json保留在hexo -g生成的文件夹里面TAT Vercel 在项目根目录创建一个vercel.json文件,内容如下: json { "rewrites": [{ "source": "/:path", "destination": "/index.html" }] } 不需要在生成文件夹里,你把它放在项目根目录,Vercel会自己读取这个文件,试一下 — Reply to this email directly, view it on GitHub <#185 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN66A5MCBSSWFT67OSHU3L3XTYCC5ANCNFSM5RRWNSZA. You are receiving this because you commented.

额额,你这样的话应该不行,正常的流程应该是你的 Github 上保存着你的项目源码,Vercel 获取你的项目源码在线上生成然后部署。如果你要自己生成,你得把这个 json 手动放到生成的文件夹里。

TTsdzb avatar Aug 05 '23 08:08 TTsdzb

这么神奇玄学吗?!我的vercel对应的是我的github,但是我的github只有生成之后的那些文件,我觉得vercel接触不到这个文件呀,那我试一试 2023年8月5日 16:47,TTsdzb @.**> 写道: 自定义页面之间不发生跳转以及 about 页面再刷新404 bug #178 <#178> 我查了查他让我这样做,但是我不知道怎么做才能让这个vercel.json保留在hexo -g生成的文件夹里面TAT Vercel 在项目根目录创建一个vercel.json文件,内容如下: json { "rewrites": [{ "source": "/:path", "destination": "/index.html" }] } 不需要在生成文件夹里,你把它放在项目根目录,Vercel会自己读取这个文件,试一下 — Reply to this email directly, view it on GitHub <#185 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN66A5MCBSSWFT67OSHU3L3XTYCC5ANCNFSM5RRWNSZA. You are receiving this because you commented.

额额,你这样的话应该不行,正常的流程应该是你的 Github 上保存着你的项目源码,Vercel 获取你的项目源码在线上生成然后部署。如果你要自己生成,你得把这个 json 手动放到生成的文件夹里。

怎么可以把这个json一直放到文件夹里面,类似那个favicon.ico一样

fffmath avatar Aug 05 '23 09:08 fffmath

怎么可以把这个json一直放到文件夹里面,类似那个favicon.ico一样

你试试直接放在 source 文件夹里呢?

TTsdzb avatar Aug 05 '23 09:08 TTsdzb

没有用

2023年8月5日 17:13,TTsdzb @.***> 写道:

怎么可以把这个json一直放到文件夹里面,类似那个favicon.ico一样

你试试直接放在 source 文件夹里呢?

— Reply to this email directly, view it on GitHub https://github.com/auroral-ui/hexo-theme-aurora/issues/185#issuecomment-1666449632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN66A5O6UYWNPOSPBXCHAVLXTYFEFANCNFSM5RRWNSZA. You are receiving this because you commented.

fffmath avatar Aug 05 '23 09:08 fffmath

我知道了,这样做可以做到: include:

  • 'vercel.json' exclude: ignore: 然后再 skip_render:
  • 'vercel.json'

fffmath avatar Aug 05 '23 09:08 fffmath

我知道了,这样做可以做到:

include:
  - 'vercel.json'
exclude:
ignore:

然后再

skip_render:
  - 'vercel.json'

这样也可以完成任务,但严格上说这个东西不是这样设计的,你这样比较绕弯子……

“部署到 git 仓库”这个功能是用来把生成好的文件推送到自己的云服务器上用的。而 Vercel 部署项目的过程自带了生成的步骤,所以跟这个不太一样。具体可以参考 Hexo 的官方文档

如果你有时间,建议你修改一下你部署的方式。首先按官方文档的第一步添加一个构建脚本(如果已经有那一条就不用添加了),随后把整个 Hexo 项目上传到一个 Github 仓库,最后在 Vercel 中新建项目并导入这个项目仓库。 Vercel 会根据你的构建脚本自动配置好,而且以后你对博客做了修改,只要推送到 Github,Vercel 会自动生成并部署。

之后你只要在 _config.yml 同级的目录下放置 vercel.json 就可以了。

TTsdzb avatar Aug 05 '23 09:08 TTsdzb

但是你这样做 就是不用hexo d了吧,每次都直接全push到github分支上然后等vercel生成

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2023年08月05日 17:46 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [auroral-ui/hexo-theme-aurora] 在查看文章页面时,一旦刷新,就显示404 (Issue #185) |

我知道了,这样做可以做到:

include:

  • 'vercel.json'exclude: ignore:

然后再

skip_render:

  • 'vercel.json'

这样也可以完成任务,但严格上说这个东西不是这样设计的,你这样比较绕弯子……

“部署到 git 仓库”这个功能是用来把生成好的文件推送到自己的云服务器上用的。而 Vercel 部署项目的过程自带了生成的步骤,所以跟这个不太一样。具体可以参考 Hexo 的官方文档。

如果你有时间,建议你修改一下你部署的方式。首先按官方文档的第一步添加一个构建脚本(如果已经有那一条就不用添加了),随后把整个 Hexo 项目上传到一个 Github 仓库,最后在 Vercel 中新建项目并导入这个项目。 Vercel 会根据你的构建脚本自动配置好,而且以后你对博客做了修改,只要推送到 Github,Vercel 会自动生成并部署。

之后你只要在 _config.yml 同级的目录下放置 vercel.json 就可以了。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

fffmath avatar Aug 05 '23 09:08 fffmath

但是你这样做 就是不用hexo d了吧,每次都直接全push到github分支上然后等vercel生成

是这样的

TTsdzb avatar Aug 05 '23 10:08 TTsdzb

我习惯直接hexo cl &hexo g &hexo s看一下 然后再改成hexo d,我知道你那种方式,我还是习惯这样

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2023年08月05日 18:00 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [auroral-ui/hexo-theme-aurora] 在查看文章页面时,一旦刷新,就显示404 (Issue #185) |

但是你这样做 就是不用hexo d了吧,每次都直接全push到github分支上然后等vercel生成

是这样的

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

fffmath avatar Aug 05 '23 10:08 fffmath

我习惯直接hexo cl &hexo g &hexo s看一下 然后再改成hexo d,我知道你那种方式,我还是习惯这样

额其实是一样的,只不过把 hexo d 换成了 git push _(:3」∠)_

另外还有个问题,vercel.json 属于是给服务器看的配置文件,但是它在一些你可能没留意的地方暴露到了站点上(https://fffmath.github.io/vercel.json)。这并不是个好习惯 (・.・;)

TTsdzb avatar Aug 05 '23 10:08 TTsdzb

好的,谢谢。

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2023年08月05日 18:12 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [auroral-ui/hexo-theme-aurora] 在查看文章页面时,一旦刷新,就显示404 (Issue #185) |

我习惯直接hexo cl &hexo g &hexo s看一下 然后再改成hexo d,我知道你那种方式,我还是习惯这样

额其实是一样的,只不过把 hexo d 换成了 git push(:3」∠)

另外还有个问题,vercel.json 属于是给服务器看的配置文件,但是它在一些你可能没留意的地方暴露到了站点上(https://fffmath.github.io/vercel.json)。这并不是个好习惯 (・.・;)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

fffmath avatar Aug 05 '23 10:08 fffmath

This issue is stale because it has been open for 30 days with no activity.

auroral-bot[bot] avatar Sep 05 '23 02:09 auroral-bot[bot]

url: https://blog.ezrealbbb.space permalink: /post/:title permalink_defaults: pretty_urls: trailing_index: true # Set to false to remove trailing 'index.html' from permalinks trailing_html: true # Set to false to remove trailing '.html' from permalinks 原本在博客页面刷新404,配置了Permalinks后刷新后下载该页面

bkf777 avatar Nov 03 '23 09:11 bkf777

url: https://blog.ezrealbbb.space permalink: /post/:title permalink_defaults: pretty_urls: trailing_index: true # Set to false to remove trailing 'index.html' from permalinks trailing_html: true # Set to false to remove trailing '.html' from permalinks Originally, the blog page refreshed with 404. After configuring Permalinks, refresh and download the page.

Happened the same to me. Fixed with these options on _config.yml:

permalink: /post/:title.html
pretty_urls:
  trailing_index: true
  trailing_html: true

rtoscani avatar Dec 06 '23 16:12 rtoscani

trailing_html配置为false后可以正常刷新,不会触发浏览器下载页面的行为

permalink: /post/:title.html
pretty_urls:
  trailing_index: true
  trailing_html: false

QDHecer avatar Dec 19 '23 15:12 QDHecer

trailing_html配置为false后可以正常刷新,不会触发浏览器下载页面的行为

permalink: /post/:title.html
pretty_urls:
  trailing_index: true
  trailing_html: false

感谢,问题已解决

cyl-ly avatar Dec 24 '23 10:12 cyl-ly