I can not access “og:url”

Hi,
I’ve got a problem. I can not access “og:url”. I am using hugo version 0.29.

Current setup:

config.toml

baseURL = "https://abc.net/blog/";
canonifyurls = true

head.html

<meta property="og:url" content="{{ .URL | absLangURL }}" />
<link rel="canonical" href="{{ .URL | absLangURL }}" />

I executed the following commands. “public/20171001.html” was generated.

$ hugo --theme=beautifulhugo

public/20171001.html

<meta property="og:url" content="https://abc.net/20171001.html" />
<link rel="canonical" href="https://abc.net/20171001.html" />

I can access
https://abc.net/blog/20171001.html”.But, I can not access "https://abc.net/20171001.html”.I wonder how I can resolve this problem.

There are so many moving parts to getting URLs set up in a multi-lingual configuration, you’ll need to provide more information to get help. Put your code in a public place and link to it.

Here’s what I use, and works just fine:

<meta property="og:url" content="{{ .Permalink }}">
<link rel="canonical" href="{{ .Permalink }}">

You could also use Hugo’s internal partial for OpenGraph (which, admittedly, isn’t documented):

{{ template "_internal/opengraph.html" }}
2 Likes

Thank you for your reply.
I pushed my code to GitHub.


https://github.com/eiKatou/eikatou.net/blob/master/layouts/partials/head.html

I fixed head.html.
https://github.com/eiKatou/eikatou.net/commit/87226828de4ed63b2b3828b208c5036c6e7b08c3#diff-35755203408c34159ac6094e42351391

Thank you for your reply.
I fixed the code. It works fine.

Thank you very much.