Open drupalninja opened 4 years ago
I sometimes use forestry.io to maintain my site, and I don't have problems with the preview server (well, actually I do, but I think it's due to using git-lfs on bitbucket). I don't think absURL should break things, but lets look into it.
Does the site work with you run on the development server (hugo server
), and does it work on your live site?
Could you post a link to your site's git repository?
You can check out my fork here: https://github.com/drupalninja/alpha-church
I rejiggered some of the URLs to make it work on Forestry, locally and on Gitlab Pages.
I also converted the Images field to a single image field in my fork. It seems like the usage was mostly a single image anyway.
I'm not sure why relURL
would break things on forestry - maybe it's because of leading forward slashes on urls?
As to the images field: the reason it's an array is for maximal compatibility with the twitter and opengraph templates (i.e. for sharing links on facebook and twitter). If that's not a feature you're interested in, you could change the theme to store the value in a string rather than an array (as you've done).
absURL was breaking things on forestry because it was adding the Hugo server port number to requests (8080). relURL fixed it for the most part. I had to move one of the background images to an inline style because it was adding a localhost:8080 domain to the request.
Sounds like something is wrong with forestry. It shouldn't be using localhost:8080
as the url.
For my forestry setup, the build command is hugo server -D -E -F --port 8080 --bind 0.0.0.0 --renderToDisk -d public
. Is it the same for you? Can I recommend looking at the forestry documentation and maybe asking in the forestry slack community.
This is my .forestry/settings.yml
if it's any help.
---
new_page_extension: md
auto_deploy: false
admin_path: ''
webhook_url:
sections:
- type: directory
path: content/sermons
label: Sermons
create: all
match: "**/*"
- type: directory
path: content/posts
label: Posts
create: all
match: "**/*"
- type: directory
path: content
label: Pages
create: all
match: "*"
upload_dir: static/uploads
public_path: "/uploads"
front_matter_path: ''
use_front_matter_path: false
file_template: ":year:/:month:/:filename:"
instant_preview: false
build:
preview_env:
- HUGO_ENV=staging
- HUGO_VERSION=0.62.2
preview_output_directory: public
preview_docker_image: forestryio/hugo:latest
mount_path: "/srv"
instant_preview_command: hugo server -D -E -F --port 8080 --bind 0.0.0.0 --renderToDisk
-d public
publish_command: hugo -d public
publish_env:
- HUGO_ENV=production
- HUGO_VERSION=0.62.2
output_directory: public
preview_command: hugo -E -F -D -b $DEPLOY_URL -d public
version: 0.62.2
Actually, I've just tried their instant previews and I'm now (possibly) seeing the problem. Though I don't think it's to do with absURL
, but sha256 checksums being mismatched (at least, that's what's coming up on the firefox dev console).
I'll start a conversation about this on their slack channel and see what help there is.
At any rate, I think the changes I added help the situation with instant previews
The theme works great but the absolute URL's break some CSS and images. If we use relative URLs then that would not be the case.