Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(meta): Add article meta #18044

Merged
merged 1 commit into from Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions news/routes/Featured/Featured.js
Expand Up @@ -152,6 +152,7 @@ class Featured extends Component {
<div>
<Helmet>
<style>{styles}</style>
<title>Featured | freeCodeCamp News</title>
</Helmet>
<ul className='featured-list'>{this.renderFeatured(featuredList)}</ul>
</div>
Expand Down
16 changes: 16 additions & 0 deletions news/routes/Show/Show.js
Expand Up @@ -177,10 +177,26 @@ class ShowArticle extends Component {
return <h2>Oh noes!! Something went wrong!</h2>;
}

// RegEx finds the first paragraph and groups the content
const description = renderableContent.match(/<p>(.*?)<\/p>/)[1];
const slug = this.props.location.pathname;
return (
<article className='show-article'>
<Helmet>
<style>{styles}</style>
<title>{`${title} | freeCodeCamp News`}</title>
<link
href={`https://www.freecodecamp.org/news${slug}`}
rel='canonical'
/>
<meta
content={`https://www.freecodecamp.org/news${slug}`}
property='og:url'
/>
<meta content={title} property='og:title' />
<meta content={description} property='og:description' />
<meta content={description} name='description' />
<meta content={featureImage.src} property='og:image' />
</Helmet>
<Author article={currentArticle} />
<h2>{title}</h2>
Expand Down