Add nightly social image [ci skip]

This commit is contained in:
Ines Montani 2020-07-01 14:41:13 +02:00
parent 5d02f71653
commit e1eb48e932
3 changed files with 6 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import { StaticQuery, graphql } from 'gatsby'
import socialImageDefault from '../images/social_default.jpg'
import socialImageApi from '../images/social_api.jpg'
import socialImageUniverse from '../images/social_universe.jpg'
import socialImageNightly from '../images/social_nightly.jpg'
function getPageTitle(title, sitename, slogan, sectionTitle) {
if (sectionTitle && title) {
@ -17,13 +18,14 @@ function getPageTitle(title, sitename, slogan, sectionTitle) {
return `${sitename} · ${slogan}`
}
function getImage(section) {
function getImage(section, nightly) {
if (nightly) return socialImageNightly
if (section === 'api') return socialImageApi
if (section === 'universe') return socialImageUniverse
return socialImageDefault
}
const SEO = ({ description, lang, title, section, sectionTitle, bodyClass }) => (
const SEO = ({ description, lang, title, section, sectionTitle, bodyClass, nightly }) => (
<StaticQuery
query={query}
render={data => {
@ -35,7 +37,7 @@ const SEO = ({ description, lang, title, section, sectionTitle, bodyClass }) =>
siteMetadata.slogan,
sectionTitle
)
const socialImage = siteMetadata.siteUrl + getImage(section)
const socialImage = siteMetadata.siteUrl + getImage(section, nightly)
const meta = [
{
name: 'description',

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

View File

@ -162,6 +162,7 @@ class Layout extends React.Component {
section={section}
sectionTitle={sectionTitle}
bodyClass={bodyClass}
nightly={meta.nightly}
/>
<AlertSpace nightly={meta.nightly} />
<Navigation