Skip to content

Commit

Permalink
Create social share twitter card. #54.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran McDade authored and NoopDog committed Jul 5, 2021
1 parent 3230725 commit 83c8f63
Show file tree
Hide file tree
Showing 30 changed files with 136 additions and 24 deletions.
Binary file added content/_images/seo/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/_images/seo/events.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/_images/seo/james.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/_images/seo/newsroom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/_images/seo/scholarships.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions content/about-james/bio.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: "James Taylor started his professional path at the University of Vermont, where he received a BS in Computer Science in 2000. In 2003, after working as a software engineer in the private sector, he found that his real purpose in life was elsewhere."
image: ../_images/seo/james.png
images:
- _images/james-at-gcc2019.png
slug: "/james"
Expand Down
5 changes: 3 additions & 2 deletions content/about-james/memorials.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: ""
title: ""
description: "Memorials to James from the Web."
image: ../_images/seo/james.png
title: "James Peter Taylor | 1979 - 2020"
---

# James Peter Taylor | 1979 - 2020
Expand Down
5 changes: 3 additions & 2 deletions content/about-james/stories.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: ""
title: ""
description: "Stories about James from people who know him well."
image: ../_images/seo/james.png
title: "James Peter Taylor | 1979 - 2020"
---

# James Peter Taylor | 1979 - 2020
Expand Down
5 changes: 3 additions & 2 deletions content/about-james/we-miss-you.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: ""
title: ""
description: "A small sample of what's been shared about James online, from his community."
image: ../_images/seo/james.png
title: "James Peter Taylor | 1979 - 2020"
---

# James Peter Taylor | 1979 - 2020
Expand Down
1 change: 1 addition & 0 deletions content/events/2021-11-genome-informatics.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: "The next Cold Spring Harbor Laboratory conference on Genome Informatics will be held at Cold Spring Harbor, New York."
image: ../_images/seo/events.png
images:
- _images/genome-informatics.png
title: "Genome Informatics 2021"
Expand Down
1 change: 1 addition & 0 deletions content/events/events.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: "Check out upcoming events."
fullWidth: true
image: ../_images/seo/events.png
images:
- _images/events-hero-genome-informatics.png
links:
Expand Down
5 changes: 3 additions & 2 deletions content/foundation/about-the-jxtx-foundation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
description: ""
description: "In its early stages, the JXTX Foundation will provide support for graduate students to attend conferences in computational biology and data science, where they can present their work and form connections with other researchers in the field."
image: ../_images/seo/about.png
slug: "/about"
title: ""
title: "About the JXTX Foundation"
---

# About the JXTX Foundation
Expand Down
5 changes: 3 additions & 2 deletions content/foundation/recent-foundation-activity-and-news.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: ""
title: ""
description: "Recent foundation activity and news."
image: ../_images/seo/about.png
title: "Foundation Activity and News"
---

# Recent Foundation Activity and News
Expand Down
5 changes: 3 additions & 2 deletions content/news/2020-05-jtech.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: ""
title: ""
description: "JTech: Junior Training and Educational Connections Hotspot."
image: ../_images/seo/newsroom.png
title: "JTech, the James Taylor Foundation"
---

# JTech, the James Taylor Foundation
Expand Down
5 changes: 3 additions & 2 deletions content/news/2020-07-bds-scholarships.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: ""
title: ""
description: "JTech and Biological Data Science 2020. JTech and CSHL will provide support to 10 outstanding graduate students in genomics and data sciences to attend the 2020 CSHL Biological Data Science Conference."
image: ../_images/seo/newsroom.png
title: "Call for Scholarship Applications"
---

# Call for Scholarship Applications
Expand Down
1 change: 1 addition & 0 deletions content/news/2020-10-jxtx-awardees.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: "JXTX: The James P. Taylor Foundation for Open Science is pleased to announce the recipients of the 2020 JTech Scholarships."
image: ../_images/seo/newsroom.png
images:
- _images/newsroom-awardees-2020-bds.png
- _images/awardee-emily-davis-marcisak.png
Expand Down
3 changes: 2 additions & 1 deletion content/news/2020-11-jxtx-joglekar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: "Making Connections via the JXTX Foundation"
description: "Making Connections via the JXTX Foundation."
image: ../_images/seo/newsroom.png
images:
- _images/jxtx-awardee-anoushka.png
title: "Scholarship Awardee: Anoushka Joglekar"
Expand Down
1 change: 1 addition & 0 deletions content/news/2020-11-jxtx-twesigomwe.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: "David participated in Biological Data Science 2020."
image: ../_images/seo/newsroom.png
images:
- _images/jxtx-awardee-david.png
title: "David Twesigomwe on the impact of the JXTX Foundation"
Expand Down
3 changes: 2 additions & 1 deletion content/news/2020-11-jxtx-zaman.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: "Discussing my research confidently with experts in the field"
description: "Discussing my research confidently with experts in the field."
image: ../_images/seo/newsroom.png
images:
- _images/jxtx-awardee-sumaira.png
title: "Sumaira Zaman: JXTX Foundation and Unique Opportunities"
Expand Down
1 change: 1 addition & 0 deletions content/news/news.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: "Check out the latest news and stories about our work."
fullWidth: true
image: ../_images/seo/newsroom.png
images:
- _images/newsroom-hero-anoushka.png
- _images/newsroom-sumaira.png
Expand Down
3 changes: 2 additions & 1 deletion content/scholarships/2021-genome-informatics.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: "JXTX 2021 Genome Informatics Scholarship"
description: "JXTX 2021 Genome Informatics Scholarship."
image: ../_images/seo/scholarships.png
images:
- _images/scholarships-hero-2021-gi.png
title: "JXTX 2021 Genome Informatics Scholarship"
Expand Down
3 changes: 2 additions & 1 deletion content/scholarships/scholarships.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: "JXTX Foundation Scholarships"
description: "JXTX Foundation Scholarships."
fullWidth: true
image: ../_images/seo/scholarships.png
images:
- _images/scholarships-hero-2021-gi.png
- _images/scholarships-hero-2020-bds.png
Expand Down
8 changes: 7 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ const contentPath = "./content";
*/
module.exports = {
siteMetadata: {
title: "jxtx",
author: "JXTX",
description: "James P. Taylor Foundation for Open Science.",
image: "/images/hero.png",
title: "JXTX Foundation",
titleTemplate: "%s · James P. Taylor Foundation for Open Science.",
twitterUsername: "@jxtxFoundation",
url: "https://jxtxfoundation.org/",
},
plugins: [
"gatsby-plugin-image",
Expand Down
1 change: 1 addition & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ exports.createSchemaCustomization = ({ actions }) => {
type Frontmatter {
description: String
fullWidth: Boolean
image: File @fileByRelativePath
images: [File] @fileByRelativePath
links: [String]
title: String
Expand Down
65 changes: 63 additions & 2 deletions src/components/document-metadata/document-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,75 @@
*/

// Core dependencies
import { useLocation } from "@reach/router";
import React from "react";
import Helmet from "react-helmet";

function DocumentMetadata() {
// App dependencies
import { SeoStaticQuery } from "../../hooks/seo-query";

function DocumentMetadata(props) {
const { frontmatter } = props || {},
{ description, image, title } = frontmatter || {},
{ childImageSharp } = image || {},
{ resize } = childImageSharp || {},
{ src } = resize || {};
const { origin, href } = useLocation();
const { siteMetadata } = SeoStaticQuery(),
{
description: siteDescription,
image: siteImage,
title: siteTitle,
twitterUsername,
} = siteMetadata || {};
const seo = {
description: description || siteDescription,
image: `${origin}${src || siteImage}`,
title: title || siteTitle,
twitterUsername: twitterUsername,
url: href,
};

return (
<Helmet>
<title>JXTX Foundation</title>
<title>{seo.title}</title>
<html lang="en" />
{/*<meta name="robots" content="noindex" />*/}
<meta content={seo.description} key="description" name="description" />
{seo.image && <meta content={seo.image} key="image" name="image" />}
<meta content={seo.url} key="og:url" property="og:url" />
<meta
content={"JXTX Foundation"}
key="og:site_name"
property="og:site_name"
/>
<meta content="website" key="og:type" property="og:type" />
<meta content={seo.title} key="og:title" property="og:title" />
<meta
content={seo.description}
key="og:description"
property="og:description"
/>
{seo.image && (
<meta content={seo.image} key="og:image" property="og:image" />
)}
<meta
content={"summary_large_image"}
key="twitter:card"
name="twitter:card"
/>
<meta
content={seo.twitterUsername}
key="twitter:site"
name="twitter:site"
/>
<meta content={seo.title} key="twitter:title" name="twitter:title" />
<meta
content={seo.description}
key="twitter:description"
name="twitter:description"
/>
<meta content={seo.image} key="twitter:image" name="twitter:image" />
</Helmet>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import "../../styles/vars.module.css";
import "../../styles/viewport-units.module.css";

function Layout(props) {
const { children, headerMinor } = props;
const { children, frontmatter, headerMinor } = props;

return (
<>
<DocumentMetadata />
<DocumentMetadata frontmatter={frontmatter} />
<div className={compStyles.site}>
<Header headerMinor={headerMinor} />
{children}
Expand Down
20 changes: 20 additions & 0 deletions src/hooks/seo-query.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useStaticQuery, graphql } from "gatsby";

export const SeoStaticQuery = () => {
const { site } = useStaticQuery(
graphql`
query SeoStaticQuery {
site {
siteMetadata {
description
image
title
url
twitterUsername
}
}
}
`
);
return site;
};
9 changes: 8 additions & 1 deletion src/templates/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Article({ data }) {
{ body: content, frontmatter } = post || {};

return (
<Layout headerMinor>
<Layout frontmatter={frontmatter} headerMinor>
<ArticleMain>
<ArticleContent content={content} frontmatter={frontmatter} />
</ArticleMain>
Expand All @@ -35,6 +35,13 @@ export const query = graphql`
frontmatter {
description
fullWidth
image {
childImageSharp {
resize {
src
}
}
}
images {
childImageSharp {
gatsbyImageData
Expand Down
Binary file added static/images/hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/jxtx-foundation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 83c8f63

Please sign in to comment.