Search code examples
google-app-enginegoogle-cloud-platformhugo

issues with deploying hugo site to google cloud app engine


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

enter image description here

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

Solution

  • See if this works....

    Instead of using static_dir, try using static_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

    - url: /([^\.]+)([^/])
      static_files: www/\1\2/index.html
      upload: www/(.+)