Skip to content

Smoke Testing 2020/11/24 - SEO fix #5211

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

Merged
merged 7 commits into from
Nov 24, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ workflows:
branches:
only:
- develop
- submission-review
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
Expand Down Expand Up @@ -261,7 +260,6 @@ workflows:
branches:
only:
- develop
- submission-review
# Production builds are exectuted
# when PR is merged to the master
# Don't change anything in this configuration
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Contentful/Route.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import _ from 'lodash';
import ContentfulLoader from 'containers/ContentfulLoader';
import Error404 from 'components/Error404';
import LoadingIndicator from 'components/LoadingIndicator';
import { MetaTags } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';
import PT from 'prop-types';
import React from 'react';
import { Route, Switch } from 'react-router-dom';
Expand Down
82 changes: 82 additions & 0 deletions src/shared/components/MetaTags.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* Auxiliary wrapper around React Helmet that helps to generate meta tags for
* generic use cases.
*
* NOTE: This component relies on `domain` path of Redux store to hold
* the current app domain, which will serve as the base path for the bundled
* images.
*/

import PT from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { Helmet } from 'react-helmet';

function MetaTags({
description,
domain,
image,
siteName,
socialDescription,
socialTitle,
title,
url,
}) {
const img = `${domain}${image}`;
const socTitle = socialTitle || title;
const socDesc = socialDescription || description;
return (
<Helmet>
{/* General tags. */}
<title>
{title}
</title>
<meta name="description" content={description} />

{/* Twitter cards. */}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={socTitle} />
<meta name="twitter:description" content={socDesc} />
{ image ? <meta name="twitter:image" content={img} /> : null }
{
siteName ? (
<meta name="twitter:site" content={`@${siteName}`} />
) : null
}

{/* Open Graph data. */}
<meta property="og:title" content={socTitle} />
{ image ? <meta property="og:image" content={img} /> : null }
{ image ? <meta property="og:image:alt" content={socTitle} /> : null }
<meta property="og:description" content={socDesc} />
{
siteName ? (<meta property="og:sitename" content={siteName} />) : null
}
{ url ? (<meta property="og:url" content={url} />) : null }
</Helmet>
);
}

MetaTags.defaultProps = {
image: null,
siteName: null,
socialDescription: null,
socialTitle: null,
url: null,
};

MetaTags.propTypes = {
description: PT.string.isRequired,
domain: PT.string.isRequired,
image: PT.string,
siteName: PT.string,
socialDescription: PT.string,
socialTitle: PT.string,
title: PT.string.isRequired,
url: PT.string,
};

/* TODO: It is not good to depend on the domain written into redux state here,
* better pass it via the renderer context at the server side, and get it from
* the location at the frontend side, or something similar? */
export default connect(state => ({ domain: state.domain }))(MetaTags);
2 changes: 1 addition & 1 deletion src/shared/components/Settings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import React from 'react';
import PT from 'prop-types';
import { MetaTags } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';

import { TABS } from 'actions/page/settings';

Expand Down
16 changes: 8 additions & 8 deletions src/shared/containers/EDU/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import React from 'react';
import { config } from 'topcoder-react-utils';
import { Helmet } from 'react-helmet';
import MetaTags from 'components/MetaTags';
import Viewport from 'components/Contentful/Viewport';
import SearchBar from 'components/Contentful/SearchBar/SearchBar';
import { getService } from 'services/contentful';
Expand Down Expand Up @@ -44,15 +44,15 @@ export default class EDUHome extends React.Component {

render() {
const { taxonomy } = this.state;
const title = 'Topcoder Thrive | Topcoder Community | Topcoder';
const description = 'Thrive is our vault of content that we have been gathering over the years. It is full of tutorials and workshops that matter. Grow with us!';

return (
<div className={homeTheme.container}>
<Helmet>
<title>THRIVE - Grow with us. Tutorials and workshops that matter.</title>
<meta name="title" property="og:title" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="description" property="og:description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="description" property="description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="twitter:description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
</Helmet>
<MetaTags
description={description}
title={title}
/>
{/* Banner */}
<div className={homeTheme.bannerContainer}>
<div className={homeTheme.bannerImage} />
Expand Down
28 changes: 19 additions & 9 deletions src/shared/containers/EDU/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import _ from 'lodash';
import moment from 'moment';
import React from 'react';
import { config, isomorphy } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';
import Viewport from 'components/Contentful/Viewport';
import SearchBar from 'components/Contentful/SearchBar/SearchBar';
import { getService } from 'services/contentful';
Expand All @@ -13,7 +14,6 @@ import { updateQuery } from 'utils/url';
import qs from 'qs';
import LoadingIndicator from 'components/LoadingIndicator';
import SearchPageFilter from 'components/Contentful/SearchPageFilter/SearchPageFilter';
import { Helmet } from 'react-helmet';
// Partials
import ResultTabs from './partials/ResultTabs';
// CSS
Expand Down Expand Up @@ -87,18 +87,28 @@ export default class EDUSearch extends React.Component {
const {
taxonomy, query, tree, isShowFilter,
} = this.state;
const title = 'Topcoder Thrive | Topcoder Community | Topcoder';
const description = 'Thrive is our vault of content that we have been gathering over the years. It is full of tutorials and workshops that matter. Grow with us!';

const metaTags = (
<MetaTags
description={description}
title={title}
/>
);
// This container needs at least those variables
// to be able to render meaningful data
if (!taxonomy) return <LoadingIndicator />;
if (!taxonomy) {
return (
<React.Fragment>
{ metaTags }
<LoadingIndicator />;
</React.Fragment>
);
}
return (
<div className={searchTheme.container}>
<Helmet>
<title>THRIVE - Search {`${query.title}`}</title>
<meta name="title" property="og:title" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="description" property="og:description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="description" property="description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="twitter:description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
</Helmet>
{ metaTags }
{/* Banner */}
<div className={searchTheme.bannerContainer}>
<div className={searchTheme.searchBarWrapp}>
Expand Down
28 changes: 19 additions & 9 deletions src/shared/containers/EDU/Tracks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import _ from 'lodash';
import moment from 'moment';
import React from 'react';
import { config, isomorphy } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';
import Viewport from 'components/Contentful/Viewport';
import SearchBar from 'components/Contentful/SearchBar/SearchBar';
import { getService } from 'services/contentful';
Expand All @@ -14,7 +15,6 @@ import qs from 'qs';
import TracksTree from 'components/Contentful/TracksTree/TracksTree';
import LoadingIndicator from 'components/LoadingIndicator';
import TracksFilter from 'components/Contentful/TracksFilter/TracksFilter';
import { Helmet } from 'react-helmet';
// SVGs & Assets
import Dev from 'assets/images/img-development.png';
import Design from 'assets/images/img_design.png';
Expand Down Expand Up @@ -163,18 +163,28 @@ export default class EDUTracks extends React.Component {
taxonomy, query, tree, isShowFilter,
articleCnt, videoCnt, forumCnt,
} = this.state;
const title = 'Topcoder Thrive | Topcoder Community | Topcoder';
const description = 'Thrive is our vault of content that we have been gathering over the years. It is full of tutorials and workshops that matter. Grow with us!';

const metaTags = (
<MetaTags
description={description}
title={title}
/>
);
// This container needs at least those variables
// to be able to render meaningful data
if (!taxonomy) return <LoadingIndicator />;
if (!taxonomy) {
return (
<React.Fragment>
{ metaTags }
<LoadingIndicator />;
</React.Fragment>
);
}
return (
<div className={tracksTheme.container}>
<Helmet>
<title>THRIVE - {`${query.track}`}</title>
<meta name="title" property="og:title" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="description" property="og:description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="description" property="description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
<meta name="twitter:description" content="THRIVE - Grow with us. Tutorials and workshops that matter." />
</Helmet>
{ metaTags }
{/* Banner */}
<div
className={tracksTheme.bannerContainer}
Expand Down
3 changes: 2 additions & 1 deletion src/shared/containers/EDU/styles/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

.container {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
width: 100%;

.bannerContainer {
background-image: linear-gradient(98.81deg, #8b41b0 0%, #ef476f 100%);
Expand Down
3 changes: 2 additions & 1 deletion src/shared/containers/EDU/styles/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

.container {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
width: 100%;

.bannerContainer {
background-color: #2a2a2a;
Expand Down
3 changes: 2 additions & 1 deletion src/shared/containers/EDU/styles/tracks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

.container {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
width: 100%;

.bannerContainer {
min-height: 475px;
Expand Down
8 changes: 7 additions & 1 deletion src/shared/containers/GigsPages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ import Viewport from 'components/Contentful/Viewport';
import { config } from 'topcoder-react-utils';
import RecruitCRMJobDetails from 'containers/Gigs/RecruitCRMJobDetails';
import { Helmet } from 'react-helmet';
import MetaTags from 'components/MetaTags';


export default function GigsPagesContainer(props) {
const { match } = props;
const { id } = match.params;
const isApply = `${config.GIGS_PAGES_PATH}/${id}/apply` === match.url;
const title = 'Gig Work | Topcoder Community | Topcoder';
const description = 'Compete and build up your profiles and skills! Topcoder members become eligible to work on Gig Work projects by first proving themselves in various skill sets through Topcoder competitions.';
return (
<div>
<Helmet>
<title>Topcoder - Gig Work Opportunities</title>
<script type="text/javascript">{`
window._chatlio = window._chatlio||[];
!function(){ var t=document.getElementById("chatlio-widget-embed");if(t&&window.ChatlioReact&&_chatlio.init)return void _chatlio.init(t,ChatlioReact);for(var e=function(t){return function(){_chatlio.push([t].concat(arguments)) }},i=["configure","identify","track","show","hide","isShown","isOnline", "page", "open", "showOrHide"],a=0;a<i.length;a++)_chatlio[i[a]]||(_chatlio[i[a]]=e(i[a]));var n=document.createElement("script"),c=document.getElementsByTagName("script")[0];n.id="chatlio-widget-embed",n.src="https://w.chatlio.com/w.chatlio-widget.js",n.async=!0,n.setAttribute("data-embed-version","2.3");
Expand All @@ -28,6 +30,10 @@ window._chatlio = window._chatlio||[];
`}
</script>
</Helmet>
<MetaTags
description={description}
title={title}
/>
<Header />
{
id ? (
Expand Down
2 changes: 1 addition & 1 deletion src/shared/containers/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PT from 'prop-types';
import { connect } from 'react-redux';

import { actions } from 'topcoder-react-lib';
import { MetaTags } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';
import Error404 from 'components/Error404';
import LoadingIndicator from 'components/LoadingIndicator';
import ProfilePage from 'components/ProfilePage';
Expand Down
2 changes: 1 addition & 1 deletion src/shared/containers/ProfileStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Error404 from 'components/Error404';
import LoadingIndicator from 'components/LoadingIndicator';
import ProfileStatsPage from 'components/ProfilePage/Stats';
import { shouldShowGraph, isValidTrack } from 'utils/memberStats';
import { MetaTags } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';
import _ from 'lodash';
import qs from 'qs';

Expand Down
24 changes: 12 additions & 12 deletions src/shared/containers/challenge-detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
SUBTRACKS,
CHALLENGE_STATUS,
} from 'utils/tc';
import { config, MetaTags } from 'topcoder-react-utils';
import { config } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';
import { actions } from 'topcoder-react-lib';
import { getService } from 'services/contentful';
// import {
Expand Down Expand Up @@ -369,10 +370,17 @@ class ChallengeDetailPageContainer extends React.Component {

const isLoggedIn = !_.isEmpty(auth.tokenV3);

const { prizeSets } = challenge;
let challengePrizes = [];
const placementPrizes = _.find(prizeSets, { type: 'placement' });
if (placementPrizes) {
challengePrizes = _.filter(placementPrizes.prizes, p => p.value > 0);
}

/* Generation of data for SEO meta-tags. */
let prizesStr;
if (challenge.prizes && challenge.prizes.length) {
prizesStr = challenge.prizes.map(p => `$${p}`).join('/');
let prizesStr = '';
if (!_.isEmpty(challengePrizes)) {
prizesStr = challengePrizes.map(p => `$${p.value}`).join('/');
prizesStr = `[${prizesStr}] - `;
}
const title = 'Topcoder Challenge | Topcoder Community | Topcoder';
Expand All @@ -398,18 +406,10 @@ class ChallengeDetailPageContainer extends React.Component {
hasFirstPlacement = _.some(winners, { placement: 1, handle: userHandle });
}


const submissionEnded = status === CHALLENGE_STATUS.COMPLETED
|| (!_.some(phases, { name: 'Submission', isOpen: true })
&& !_.some(phases, { name: 'Checkpoint Submission', isOpen: true }));

const { prizeSets } = challenge;
let challengePrizes = [];
const placementPrizes = _.find(prizeSets, { type: 'placement' });
if (placementPrizes) {
challengePrizes = placementPrizes.prizes;
}

return (
<div styleName="outer-container">
<div styleName="challenge-detail-container" role="main">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import sidebarActions from 'actions/challenge-listing/sidebar';
import communityActions from 'actions/tc-communities';
// import SORT from 'utils/challenge-listing/sort';
import { BUCKETS, filterChanged, sortChangedBucket } from 'utils/challenge-listing/buckets';
import { MetaTags } from 'topcoder-react-utils';
import MetaTags from 'components/MetaTags';
import { USER_GROUP_MAXAGE } from 'config';
import { updateChallengeType } from 'utils/challenge';

Expand Down
Loading