wrangler --version
wrangler 1.4.0-rc.1
I made a one page Hugo static site, with an index and one post available at /posts/hello-world/ (static file path public/posts/hello-world.html).
Using the Hugo server, I can click my link and go to /posts/hello-world/ and see my post.
Using wrangler publish: /posts/hello-world/ is a 404 -- but /posts/hello-world/index.html is a 200.
Hi there! Do you mind telling us what your generated Hugo directory looks like?
For what it's worth, I use Hugo for my site, https://blog.ziggy.workers.dev/. My hugo routing works for scenarios like the one you just described. A key thing for pretty hugo URLS is that they are represented in /public like public/posts/hello-world/index.html. This doesn't seem to be your case above.
The behavior you're describing above actually represents ugly urls: https://gohugo.io/content-management/urls/. Mind re-generating your site with Hugo and making sure you're using pretty urls?
find public/
public/
public/css
public/css/bootstrap.min.css
public/index.html
public/tags
public/tags/index.html
public/tags/index.xml
public/js
public/js/jquery-3.3.1.slim.min.js
public/js/bootstrap.bundle.min.js
public/categories
public/categories/index.html
public/categories/index.xml
public/posts
public/posts/index.html
public/posts/hello-world
public/posts/hello-world/index.html
public/posts/index.xml
public/index.xml
public/sitemap.xml
My entire Hugo config is:
baseURL = "https://blag.brett.workers.dev/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "minimal-bootstrap-hugo-theme"
So this should work! Have you tried again?
No dice.
~/cf-repos/wrangler/blag wrangler --version
wrangler 1.4.0-rc.1
~/cf-repos/wrangler/blag rm -rf public/
~/cf-repos/wrangler/blag hugo
| EN
+------------------+----+
Pages | 9
Paginator pages | 0
Non-page files | 0
Static files | 3
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
Total in 17 ms
~/cf-repos/wrangler/blag wrangler publish
Creating namespace for Workers Site "__blag-workers_sites_assets"
Uploading...
Success
猬囷笍 Installing wranglerjs...
猬囷笍 Installing wasm-pack...
Built successfully, built project size is 4 KiB.
Successfully published your script to https://blag.brett.workers.dev
maybe useful: https://blag.brett.workers.dev/posts/hello-world/index.html does work
also blag is a good name
Hi @bretthoerner! I'm sorry this has been frustrating. To help me debug, can you tell me what version of kv-asset-handler you're on? You can find this in workers-site/package.json in your blag directory.
If you're still on version 0.0.1, that explains this bug--this was fixed in 0.0.2 onwards.
Yeah, it's "@cloudflare/kv-asset-handler": "0.0.1". For what it's worth I installed Wrangler @cloudflare/[email protected] at the QA thing and everyone seemed surprise this happened.
This was fixed by 0.0.2; if you upgrade to it, this url scheme should work :)
Cool, upgrading wrangler to rc4 and then removing workers-site/ did the trick. I will note for future changes that it feels weird to have to nuke (or edit) a directory I didn't create myself.
That's a great point. Wrangler should be willing to overwrite workers-site/, but additionally, we will ship Wrangler on friday and ensure it points to the correct version of the kv-assets-handler package.
How exactly did you guys address this problem? Do I just manually edit the package.json file and put it as 0.0.2? I am facing similar issue with my hugo build. Also the WWW extension wouldn't work only the one without www extension loads. No idea how to fix that!
@roshanjonah - yes, you should be able to manually edit your package.json file to update kv-asset-handler. Our latest release is version 0.0.11 though, so I'd set it to that instead of 0.0.2 :)