mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-25 14:29:36 +01:00
Add thumbnail image to Twitter cards.
This commit is contained in:
parent
fcedb2194a
commit
ebc6134453
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: "About me"
|
title: "About me"
|
||||||
template: "page"
|
template: "page"
|
||||||
|
socialImage: "/media/image-2.jpg"
|
||||||
---
|
---
|
||||||
|
|
||||||
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.
|
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: "Contact me"
|
title: "Contact me"
|
||||||
template: "page"
|
template: "page"
|
||||||
|
socialImage: "/media/image-4.jpg"
|
||||||
---
|
---
|
||||||
|
|
||||||
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.
|
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.
|
||||||
|
@ -9,6 +9,7 @@ tags:
|
|||||||
- "Handwriting"
|
- "Handwriting"
|
||||||
- "Learning to write"
|
- "Learning to write"
|
||||||
description: "Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum."
|
description: "Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum."
|
||||||
|
socialImage: "/media/image-2.jpg"
|
||||||
---
|
---
|
||||||
|
|
||||||
Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum.
|
Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum.
|
||||||
|
@ -6,6 +6,7 @@ draft: false
|
|||||||
slug: "/posts/the-origins-of-social-stationery-lettering"
|
slug: "/posts/the-origins-of-social-stationery-lettering"
|
||||||
category: "Design Culture"
|
category: "Design Culture"
|
||||||
description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante."
|
description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante."
|
||||||
|
socialImage: "/media/image-3.jpg"
|
||||||
---
|
---
|
||||||
|
|
||||||
**Pellentesque habitant morbi tristique** senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. *Aenean ultricies mi vitae est.* Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.
|
**Pellentesque habitant morbi tristique** senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. *Aenean ultricies mi vitae est.* Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.
|
||||||
|
@ -11,6 +11,7 @@ tags:
|
|||||||
- "History of typography"
|
- "History of typography"
|
||||||
- "Helvetica"
|
- "Helvetica"
|
||||||
description: "Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat."
|
description: "Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat."
|
||||||
|
socialImage: "/media/image-0.jpg"
|
||||||
---
|
---
|
||||||
|
|
||||||
**Pellentesque habitant morbi tristique** senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. *Aenean ultricies mi vitae est.* Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.
|
**Pellentesque habitant morbi tristique** senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. *Aenean ultricies mi vitae est.* Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.
|
||||||
|
@ -10,6 +10,7 @@ tags:
|
|||||||
- "Gatsby"
|
- "Gatsby"
|
||||||
- "Typography"
|
- "Typography"
|
||||||
description: "German inventor Johannes Gutenberg developed a method of movable type and used it to create one of the western world’s first major printed books, the “Forty–Two–Line” Bible."
|
description: "German inventor Johannes Gutenberg developed a method of movable type and used it to create one of the western world’s first major printed books, the “Forty–Two–Line” Bible."
|
||||||
|
socialImage: "/media/gutenberg.jpg"
|
||||||
---
|
---
|
||||||
|
|
||||||
German inventor Johannes Gutenberg developed a method of movable type and used it to create one of the western world’s first major printed books, the “Forty–Two–Line” Bible.
|
German inventor Johannes Gutenberg developed a method of movable type and used it to create one of the western world’s first major printed books, the “Forty–Two–Line” Bible.
|
||||||
|
@ -10,6 +10,7 @@ tags:
|
|||||||
- "Typography"
|
- "Typography"
|
||||||
- "Web Development"
|
- "Web Development"
|
||||||
description: "An Essay on Typography by Eric Gill takes the reader back to the year 1930. The year when a conflict between two worlds came to its term. The machines of the industrial world finally took over the handicrafts."
|
description: "An Essay on Typography by Eric Gill takes the reader back to the year 1930. The year when a conflict between two worlds came to its term. The machines of the industrial world finally took over the handicrafts."
|
||||||
|
socialImage: "/media/42-line-bible.jpg"
|
||||||
---
|
---
|
||||||
|
|
||||||
- [The first transition](#the-first-transition)
|
- [The first transition](#the-first-transition)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// @flow strict
|
// @flow strict
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Helmet from 'react-helmet';
|
import Helmet from 'react-helmet';
|
||||||
|
import { withPrefix } from 'gatsby';
|
||||||
import type { Node as ReactNode } from 'react';
|
import type { Node as ReactNode } from 'react';
|
||||||
|
import { useSiteMetadata } from '../../hooks';
|
||||||
import styles from './Layout.module.scss';
|
import styles from './Layout.module.scss';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -10,19 +12,26 @@ type Props = {
|
|||||||
description?: string
|
description?: string
|
||||||
};
|
};
|
||||||
|
|
||||||
const Layout = ({ children, title, description }: Props) => (
|
const Layout = ({ children, title, description, socialImage }: Props) => {
|
||||||
<div className={styles.layout}>
|
const { author, url } = useSiteMetadata();
|
||||||
<Helmet>
|
const metaImage = socialImage != null ? socialImage : author.photo;
|
||||||
<html lang="en" />
|
const metaImageUrl = url + withPrefix(metaImage);
|
||||||
<title>{title}</title>
|
|
||||||
<meta name="description" content={description} />
|
return (
|
||||||
<meta property="og:site_name" content={title} />
|
<div className={styles.layout}>
|
||||||
<meta name="twitter:card" content="summary" />
|
<Helmet>
|
||||||
<meta name="twitter:title" content={title} />
|
<html lang="en" />
|
||||||
<meta name="twitter:description" content={description} />
|
<title>{title}</title>
|
||||||
</Helmet>
|
<meta name="description" content={description} />
|
||||||
{children}
|
<meta property="og:site_name" content={title} />
|
||||||
</div>
|
<meta name="twitter:card" content="summary" />
|
||||||
);
|
<meta name="twitter:title" content={title} />
|
||||||
|
<meta name="twitter:description" content={description} />
|
||||||
|
<meta name="twitter:image" content={metaImageUrl} />
|
||||||
|
</Helmet>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
export default Layout;
|
export default Layout;
|
||||||
|
@ -16,11 +16,11 @@ type Props = {
|
|||||||
const PageTemplate = ({ data }: Props) => {
|
const PageTemplate = ({ data }: Props) => {
|
||||||
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
||||||
const { html: pageBody } = data.markdownRemark;
|
const { html: pageBody } = data.markdownRemark;
|
||||||
const { title: pageTitle, description: pageDescription } = data.markdownRemark.frontmatter;
|
const { title: pageTitle, description: pageDescription, socialImage } = data.markdownRemark.frontmatter;
|
||||||
const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle;
|
const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription}>
|
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImage} >
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
<Page title={pageTitle}>
|
<Page title={pageTitle}>
|
||||||
<div dangerouslySetInnerHTML={{ __html: pageBody }} />
|
<div dangerouslySetInnerHTML={{ __html: pageBody }} />
|
||||||
@ -38,6 +38,7 @@ export const query = graphql`
|
|||||||
title
|
title
|
||||||
date
|
date
|
||||||
description
|
description
|
||||||
|
socialImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ type Props = {
|
|||||||
|
|
||||||
const PostTemplate = ({ data }: Props) => {
|
const PostTemplate = ({ data }: Props) => {
|
||||||
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
||||||
const { title: postTitle, description: postDescription } = data.markdownRemark.frontmatter;
|
const { title: postTitle, description: postDescription, socialImage } = data.markdownRemark.frontmatter;
|
||||||
const metaDescription = postDescription !== null ? postDescription : siteSubtitle;
|
const metaDescription = postDescription !== null ? postDescription : siteSubtitle;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription}>
|
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImage} >
|
||||||
<Post post={data.markdownRemark} />
|
<Post post={data.markdownRemark} />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
@ -38,6 +38,7 @@ export const query = graphql`
|
|||||||
description
|
description
|
||||||
tags
|
tags
|
||||||
title
|
title
|
||||||
|
socialImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user