feat(meta): Add article meta (#18044)
This commit is contained in:
committed by
Quincy Larson
parent
372f73ebdb
commit
903e28ee6a
@ -152,6 +152,7 @@ class Featured extends Component {
|
|||||||
<div>
|
<div>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<style>{styles}</style>
|
<style>{styles}</style>
|
||||||
|
<title>Featured | freeCodeCamp News</title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<ul className='featured-list'>{this.renderFeatured(featuredList)}</ul>
|
<ul className='featured-list'>{this.renderFeatured(featuredList)}</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -177,10 +177,26 @@ class ShowArticle extends Component {
|
|||||||
return <h2>Oh noes!! Something went wrong!</h2>;
|
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 (
|
return (
|
||||||
<article className='show-article'>
|
<article className='show-article'>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<style>{styles}</style>
|
<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>
|
</Helmet>
|
||||||
<Author article={currentArticle} />
|
<Author article={currentArticle} />
|
||||||
<h2>{title}</h2>
|
<h2>{title}</h2>
|
||||||
|
Reference in New Issue
Block a user