将 Hugo 网站部署到 Google Cloud 应用程序引擎时出现问题
所以我正在尝试将我的 Hugo 博客部署到谷歌云应用程序引擎,但我遇到了 URL 映射问题,我已经玩了很多次,但似乎没有任何作用
主页正在工作,我可以看到帖子,但当我点击帖子时出现错误:未找到消息
app.yaml
env: standard
runtime: nodejs16
service: default
handlers:
- url: /
static_files: public/index.html
upload: public/index.html
- url: /posts
static_dir: public/posts
- url: /(.*)
static_files: public/\1
upload: public/(.*)
文件结构
网站链接:https://www.waelfadlallah.com/
感谢 NoCommandLine 问题已解决,这是我的 app.yaml 现在的样子
env: standard
runtime: nodejs16
service: default
handlers:
- url: /posts/(.+)/
static_files: public/posts/\1/index.html
upload: public/posts/(.+)/index.html
- url: /assets
static_dir: public/assets
- url: /
static_files: public/index.html
upload: public/index.html
So I'm trying to deploy my Hugo blog to google cloud app engine, but I'm having issue with the URL mapping,I have played with it a lot but nothing seem to work
The home page is working and I can see the the posts but when I click on a post I got error: Not Found message
app.yaml
env: standard
runtime: nodejs16
service: default
handlers:
- url: /
static_files: public/index.html
upload: public/index.html
- url: /posts
static_dir: public/posts
- url: /(.*)
static_files: public/\1
upload: public/(.*)
Files structure
website link: https://www.waelfadlallah.com/
Thank to NoCommandLine the issue is resolved, here is how my app.yaml looks like now
env: standard
runtime: nodejs16
service: default
handlers:
- url: /posts/(.+)/
static_files: public/posts/\1/index.html
upload: public/posts/(.+)/index.html
- url: /assets
static_dir: public/assets
- url: /
static_files: public/index.html
upload: public/index.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这是否有效......
而不是使用
static_dir
,而是尝试使用static_files
并让你的处理程序像示例 此处。该示例有(下面的示例)。看看是否可以修改它以适合您的模式See if this works....
Instead of using
static_dir
, try usingstatic_files
and have your handler like the example here. That example has (the sample below). See if you can modify it to suit your pattern