Skip to content

Commit

Permalink
Adding baseUrl to feed links. (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
skratchdot authored and JoelMarcey committed Jun 10, 2018
1 parent 3c6d3e6 commit 8e58d2e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions lib/core/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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" />}
Expand All @@ -81,15 +78,15 @@ 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'}
/>
)}
{hasBlog && (
<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'}
/>
)}
Expand Down

0 comments on commit 8e58d2e

Please sign in to comment.