Adding baseUrl to feed links. (#745)

This commit is contained in:
skratchdot 2018-06-10 13:56:29 -04:00 committed by Joel Marcey
parent 3c6d3e6df7
commit 8e58d2e903

View file

@ -29,6 +29,11 @@ class Head extends React.Component {
highlight.version
}/styles/${highlight.theme}.min.css`;
// ensure the siteUrl variable ends with a single slash
const siteUrl =
(this.props.config.url + this.props.config.baseUrl).replace(/\/+$/, '') +
'/';
return (
<head>
<meta charSet="utf-8" />
@ -44,22 +49,14 @@ class Head extends React.Component {
{this.props.config.ogImage && (
<meta
property="og:image"
content={
this.props.config.url +
this.props.config.baseUrl +
this.props.config.ogImage
}
content={siteUrl + this.props.config.ogImage}
/>
)}
<meta name="twitter:card" content="summary" />
{this.props.config.twitterImage && (
<meta
name="twitter:image"
content={
this.props.config.url +
this.props.config.baseUrl +
this.props.config.twitterImage
}
content={siteUrl + this.props.config.twitterImage}
/>
)}
{this.props.config.noIndex && <meta name="robots" content="noindex" />}
@ -81,7 +78,7 @@ class Head extends React.Component {
<link
rel="alternate"
type="application/atom+xml"
href={this.props.config.url + '/blog/atom.xml'}
href={siteUrl + 'blog/atom.xml'}
title={this.props.config.title + ' Blog ATOM Feed'}
/>
)}
@ -89,7 +86,7 @@ class Head extends React.Component {
<link
rel="alternate"
type="application/rss+xml"
href={this.props.config.url + '/blog/feed.xml'}
href={siteUrl + 'blog/feed.xml'}
title={this.props.config.title + ' Blog RSS Feed'}
/>
)}