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 highlight.version
}/styles/${highlight.theme}.min.css`; }/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 ( return (
<head> <head>
<meta charSet="utf-8" /> <meta charSet="utf-8" />
@ -44,22 +49,14 @@ class Head extends React.Component {
{this.props.config.ogImage && ( {this.props.config.ogImage && (
<meta <meta
property="og:image" property="og:image"
content={ content={siteUrl + this.props.config.ogImage}
this.props.config.url +
this.props.config.baseUrl +
this.props.config.ogImage
}
/> />
)} )}
<meta name="twitter:card" content="summary" /> <meta name="twitter:card" content="summary" />
{this.props.config.twitterImage && ( {this.props.config.twitterImage && (
<meta <meta
name="twitter:image" name="twitter:image"
content={ content={siteUrl + this.props.config.twitterImage}
this.props.config.url +
this.props.config.baseUrl +
this.props.config.twitterImage
}
/> />
)} )}
{this.props.config.noIndex && <meta name="robots" content="noindex" />} {this.props.config.noIndex && <meta name="robots" content="noindex" />}
@ -81,7 +78,7 @@ class Head extends React.Component {
<link <link
rel="alternate" rel="alternate"
type="application/atom+xml" 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'} title={this.props.config.title + ' Blog ATOM Feed'}
/> />
)} )}
@ -89,7 +86,7 @@ class Head extends React.Component {
<link <link
rel="alternate" rel="alternate"
type="application/rss+xml" 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'} title={this.props.config.title + ' Blog RSS Feed'}
/> />
)} )}