Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(/\/+$/, '') +
'/';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this won't cause a possible double ending // when we use it below?

For example, siteUrl always ends with a single slash. Could this.props.config.ogImage start with a single slash, causing a // in line 51?

Just wanting to make sure we are still good there.


return (
<head>
<meta charSet="utf-8" />
Expand All @@ -43,22 +48,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 @@ -80,15 +77,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