There seems to be a slight issue with this approach:
The opengraph tags for FB (internal tempalte) render as such:
<meta property="og:url" content="/" />
And
Object at URL ‘https://marijuanadaily.net/’ of type ‘website’ is invalid because the given value ‘/’ for property ‘og:url’ could not be parsed as type ‘url’.
^ Error from Facebook Debugger
config.toml
baseurl = ""
/layouts/index.html
{{.Site.BaseURL}} returns //localhost:1313 (on my machine)
{{.Site.BaseURL}} returns nothing (empty string) (on my server or netflify)`
EDIT: FB dugger also shows this (apparently it somehow fills in og:url by itself even if we outptu “/”):
Based on the raw tags, we constructed the following Open Graph properties
fb:app_id
og:url http://marijuanadaily.net/
og:type
og:title Health & Wellness with Daily Marijuana Use
og:description Healing the mind and body with Marijuana Daily!
og:image https://marijuanadaily.net/img/og.png
op:markup_url
EDIT 2:
works
confit.toml
images = [“https://MarijuanaDaily.net/img/og.png”]
Does not work.
confit.toml
images = [“/img/og.png”]
FB returns an error that the image could not be found, as it requires an absolute url. However in source of internal template, it’s | absUrling it. So that should generate a full url, but it’s not.
EDIT: upon further testing, if baseurl is “”, https://dev.marijuanadaily.net/blog/ (on netlify for example) none of the internal scripts/css loads on the pages. The scripts in my template are being loaded thusly.
`
`
If baseurl=“”, then hugo renders it so that scripts are now being looked for on /news/js/front.js for example, and that’s a 404, since scripts at are /js/ and /css/ and not /news/js/ etc.
^^ This problem seems specific to Netlify. On localhost, baseurl is “” (blank) and the scripts are loaded fine on all pages. I wonder what is happening.
{{ with .Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" >
{{ end }}
If the value for images array is an element like this: “/img/path/pic.jpg” it’s still rendered as /img/path/pic.jpg instead of site.com/img/path/pic.jpg (remember it’s using absUrl so it should render a full url but it doesn’t).
There seems to be a huge difference in the way baseurl=“” is parsed by “hugo serve” vs generating the site and looking at it using another httpd.
When using “hugo serve”, the blank baseurl=“” renders as //localhost:1313 and when the site is generated, and put on nginx or apache httpd, baseurl renders as blank (no value, no output), and not “//site.com” (or whatever it maybe). When I’m on localhost, working, I do “hugo serve” and everything works fine. The baseurl=“” when echoed out in the template as {{.Site.BaseURL}}, the value is //localhost:1313. Now, I push to netflify or my vps, same soruce… the value for {{.Site.BaseURL}} is an empty string. I would expect it to be //dev.marijuandaily.net (or whatever it is. you said it should automagically fill it in. It does but only on localhost using “hugo serve”). After the site is generated and viewed on another httpd (not hugot’s internal testing httpd), the value for baseurl becomes empty string.
EDIT: The only choice I am left with at this point is to simply use a value for baseurl. Otherwise there doesn’t seem to be any solution at all to this problem. baseurl = “https://PsychedelicsDaily.com/” and baseurl = “https://MarijuanaDaily.NET/” otherwise the sites don’t function correctly.
<meta property="og:image" content="https://MarijuanaDaily.NET/img/og.png" >
so the absURL only works if baseurl is present, not blank. If we leave baseurl blank, relURL and absURL don’t render correctly.
This baseurl is giving me so many problems, parts of my site get broken… this is extremely confusing and I’ve been through all the documentation I could find.
EDIT AGAIN!: Just noticed this too, that when baseurl=“” in config.toml
ERROR 2017/04/08 17:25:49 No ‘baseURL’ set in configuration or as a flag. Features like page menus will not work without one.
EDIT AGAIN! Jeez! <3
https://marijuanadaily.net/blog/could-marijuana-give-athletes-an-unfair-advantage/
Currently, I have had to set the baseurl = "https://MarijuanaDaily.NET/"
otherwise the site is broken. Do you think I would have better luck using HUGO_* env variables in my OS?
EDIT AGAIN: Here’s something even more strange: baseurl=“” only seems to work on localhost. When deployed on vps or netlify, it breaks the sites.
@rdwatters I’ve added you as a member on both PsychedelicsDaily.com and MarijuanaDaily.net repositories as a developer on the team, so you should have access to the project in case you wish to look at the source and compare, perhaps help me do some testing. I apprecite you, man. Thank you!
LAST EDIT: For readability and coherency, as much as I’m capable. Thank you.