I’m trying to share my article using the Twitter, Facebook and LinkedIn icon on the bottom of the article on my page. However, the issue is when I click on any of the icon, only the title of the blog post shows, the URL doesn’t. I have checked the partial for it and it is using it this way:
I didn’t set url in my front matter. I don’t seem to know what’s happening though. The original theme I’m using has the same thing I have and it works but mine isn’t. perhaps, I have changed something else where and it affected it. I’m not familiar with Go, so it’s difficult trying to debug
The only difference I see is the way the ampersand is coded in my theme’s Twitter share - see full example below (minus the icon part) - note the & right before the url= - try adding that to your html and see if it makes any difference?:
In your config.toml, go ahead and add your site address:
baseURL = "https://peoray.com"
For some reason the .Permalink in the Twitter share code was not forming correctly when using only "/" as the baseURL - don’t worry, when running this on your local machine it will still work on localhost, but then you won’t have to change it when deploying to github
Is the code for the share button INSIDE of your article range? I suspect it’s outside and within the .Page context which has no URL. I have nearly the same code and it’s working at all locations I do employ it:
<div class="col">
<a class="btn btn-twitter btn-block"
href="https://twitter.com/intent/tweet?url={{.Permalink}}&via=samui2&hashtags=samui,thailand"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=800');return false;"
target="_blank"><i class="fab fa-twitter" aria-hidden="true"></i>
<span class="sr-only sr-only-focusable"> Share on Twitter</span>
</a>{{/* text is also a parameter */}}
</div>