Skip to content

Commit

Permalink
fix: hide related resources on pages that have not yet been indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Aug 13, 2020
1 parent 6165026 commit 7bf2811
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/RelatedContentModules/Resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ const normalizeDeveloperUrl = (url) =>
url.replace('https://developer.newrelic.com', '');

const Resources = ({ page }) => {
const {
relatedResources,
frontmatter: { resources },
} = page;
const { relatedResources, frontmatter } = page;
const resources = (frontmatter.resources || []).concat(relatedResources);

return (
return resources.length > 0 ? (
<Section>
<Title>Related resources</Title>
<nav>
Expand All @@ -46,7 +44,7 @@ const Resources = ({ page }) => {
padding: 0;
`}
>
{(resources || []).concat(relatedResources).map((resource) => {
{resources.map((resource) => {
const tag = findTag(resource);
const isDeveloperSite = tag === 'developer';
const LinkElement = isDeveloperSite ? Link : ExternalLink;
Expand Down Expand Up @@ -101,7 +99,7 @@ const Resources = ({ page }) => {
</ul>
</nav>
</Section>
);
) : null;
};

Resources.propTypes = {
Expand Down

0 comments on commit 7bf2811

Please sign in to comment.