Skip to content

Commit 627e84d

Browse files
Update Labs blogs social cards to use featuredImage (#744)
* update labs blog social card props * fix path for images * Add README blog social card image documentation * Change 'post list' -> 'post gallery' * Fix README typo --------- Co-authored-by: Brian Skinn <[email protected]>
1 parent 64e4d56 commit 627e84d

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Here is some basic info to help orient you to this repo.
3737
- `./libs` holds code shared by both websites.
3838
- The websites' **content** lives in [Storyblok](https://app.storyblok.com)
3939
(requires login).
40-
- But Labs and Consulting **blog posts** live under `./apps/labs/posts` and
40+
- But Labs and Consulting **blog posts** live under `./apps/labs/posts` and
4141
`./apps/consulting/posts`, respectively.
4242
- The websites are hosted and deployed via
4343
[Vercel](https://vercel.com/quansight) (requires login).
@@ -354,12 +354,12 @@ Throughout the develop-deploy process, there are several ways to view the
354354
website. The following table summarizes the important ways in which those views
355355
differ from each other.
356356

357-
| Name | How to access | GitHub branch | Vercel env | Storyblok API key | Next.js preview? | Storyblok version param | Display top overlay? | Top overlay color | Button to enter/exit preview? |
358-
| -------------------------- | ---------------------- | -------------- | ---------- | ----------------- | ---------------- | ----------------------- | ------------------- | ---------------- | ----------------------------- |
359-
| Production | .com/.org URL | `main` | production | public | off | `published` | No | n/a | n/a |
360-
| Storyblok (yellow overlay) | via Storyblok UI | `develop` | preview | preview | on | `draft` | Yes | yellow | No |
361-
| Vercel URL (gray overlay) | via link to Vercel URL | any non-`main` | preview | preview | off | `published` | Yes | gray | Yes |
362-
| Vercel URL (yellow overlay) | via enter-preview | any non-`main` | preview | preview | on | `draft` | Yes | yellow | Yes |
357+
| Name | How to access | GitHub branch | Vercel env | Storyblok API key | Next.js preview? | Storyblok version param | Display top overlay? | Top overlay color | Button to enter/exit preview? |
358+
| --------------------------- | ---------------------- | -------------- | ---------- | ----------------- | ---------------- | ----------------------- | -------------------- | ----------------- | ----------------------------- |
359+
| Production | .com/.org URL | `main` | production | public | off | `published` | No | n/a | n/a |
360+
| Storyblok (yellow overlay) | via Storyblok UI | `develop` | preview | preview | on | `draft` | Yes | yellow | No |
361+
| Vercel URL (gray overlay) | via link to Vercel URL | any non-`main` | preview | preview | off | `published` | Yes | gray | Yes |
362+
| Vercel URL (yellow overlay) | via enter-preview | any non-`main` | preview | preview | on | `draft` | Yes | yellow | Yes |
363363

364364
Let's take the row labeled "Vercel URL (gray overlay)." This view is accessed by
365365
clicking on a Vercel SHA-style URL, which looks like
@@ -547,12 +547,14 @@ signs. The meta section contains post-related information like:
547547
categories should be the same as in the previously mentioned
548548
[`categories.json`](./apps/labs/posts/categories.json) file.
549549
**Important note:** categories are case-sensitive.
550-
- `featuredImage` (required) - Object with two required properties: `src` and `alt`. The `src` property
551-
is a path to the featured image which is displayed on the posts list on the`/blog`
552-
page. The `alt` property is alternative text for the image. The image should
553-
be added to the `apps/labs/public/posts/<post-name>` directory, for example,
554-
`apps/labs/public/posts/hello-world-post`. There is no need to provide a full image path,
555-
so the path name should start with `/posts/`.
550+
- `featuredImage` (required) - Object with two required properties: `src` and `alt`.
551+
- The `src` property
552+
is a path to the featured image which is displayed both (a) in the posts gallery on the`/blog`
553+
page and (b) in rich social media preview cards (on Twitter, Slack, LinkedIn, etc.). The image should
554+
be added to the `apps/labs/public/posts/<post-name>` directory, for example,
555+
`apps/labs/public/posts/hello-world-post`. There is no need to provide a full image path,
556+
so the path name should start with `/posts/`. This image should have a 2:1 aspect ratio and a minimum height of 627 pixels.
557+
- The `alt` property is alternative text for the image.
556558
- `hero` (required) - the object for the Hero section of the post. This can have two different structures:
557559
- The first structure is an object with `imageSrc` and `imageAlt`. The `imageSrc` property is a path to
558560
the hero image, which is displayed on the blog post page between the nav bar and the

apps/labs/pages/blog/[slug].tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export const BlogPost: FC<TBlogPostProps> = ({
6666
title={post.meta.title}
6767
description={post.meta.description}
6868
variant={DomainVariant.Labs}
69+
twitterLargeImage={true}
70+
twitterImage={`https://${process.env.NEXT_PUBLIC_VERCEL_URL}${post.meta.featuredImage.src}`}
71+
ogImage={`https://${process.env.NEXT_PUBLIC_VERCEL_URL}${post.meta.featuredImage.src}`}
72+
alt={post.meta.featuredImage.alt}
6973
/>
7074
{post.meta.hero && (
7175
<Hero

0 commit comments

Comments
 (0)