Nonstandard method used for deriving twitter card image
ahelwer opened this issue · 0 comments
Don't know whether this constitutes a bug but it did confuse me for a while. The usual method of defining images to use in twitter cards (and other websites) is with the images
key in the front matter of a post, as documented here: https://gohugo.io/content-management/front-matter/
The images
key accepts a list of images of which one is chosen. So for example:
---
title: Some Post Title
...
images: ["image1.jpg", "image2.jpg"]
---
However the way this theme seems to generate twitter cards is with the image
key (not plural) and the image paths have to be absolute, not relative:
---
title: Some Post Title
...
images: "/path/to/post/directory/image.jpg"
---
Again, it's unclear whether this is a bug but it is confusing because all the documentation & tutorials out there say to use the images
tag. I dug through the theme code to figure out it had to be image
and that the path had to be absolute, not relative to the post directory like other image definitions.
There are a few possible fixes here:
- Change nothing, say this is just how it works. Probably add some documentation in the README.md about what is expected.
- Keep using
image
but change it to use relative path; perhaps there is a way to do this without breaking existing users that use absolute paths. - Change to the standard
images
key method, which I think also use relative paths