Skip to content

Commit

Permalink
chore(docs): fix social images for now
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanksdesign committed Oct 25, 2023
1 parent 5acdece commit 00229bf
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 8 deletions.
Binary file removed docs/public/android-preview.png
Binary file not shown.
Binary file removed docs/public/angular-preview.png
Binary file not shown.
Binary file removed docs/public/flutter-preview.png
Binary file not shown.
Binary file removed docs/public/preview.png
Binary file not shown.
Binary file removed docs/public/react-native-preview.png
Binary file not shown.
Binary file removed docs/public/react-preview.png
Binary file not shown.
Binary file removed docs/public/swift-preview.png
Binary file not shown.
Binary file removed docs/public/vue-preview.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/src/data/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export const PREVIEW_LINK_COLOR = '#5C6670';
* if we need to change the image in future, we have to change the image names.
* ref: https://developers.facebook.com/docs/sharing/webmasters/images/
*/
export const PREVIEW_VERSION = '3';
export const PREVIEW_VERSION = '4';
6 changes: 3 additions & 3 deletions docs/src/pages/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ export const Head = () => {
<meta property="og:url" content={`${process.env.SITE_URL}${asPath}`} />
<meta
property="og:image"
content={process.env.SITE_URL + getImagePath(asPathname)}
content={process.env.SITE_URL + getImagePath(platform as string)}
/>
<meta property="og:image:width" content={String(PREVIEW_WIDTH)} />
<meta property="og:image:height" content={String(PREVIEW_HEIGHT)} />
<meta
property="og:image:secure_url"
content={process.env.SITE_URL + getImagePath(asPathname)}
content={process.env.SITE_URL + getImagePath(platform as string)}
/>
<meta property="og:image:type" content="image/png" />
<meta property="og:image:alt" content={_description} />
Expand All @@ -71,7 +71,7 @@ export const Head = () => {
<meta name="twitter:description" content={_description} />
<meta
name="twitter:image"
content={process.env.SITE_URL + getImagePath(asPathname)}
content={process.env.SITE_URL + getImagePath(platform as string)}
/>
</NextHead>
);
Expand Down
10 changes: 6 additions & 4 deletions docs/src/utils/previews.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import slugify from 'slugify';
// import slugify from 'slugify';

import { PREVIEW_VERSION } from '../data/preview';

// For now dynamic social images are disabled
// hard-coding a preview image based on platform until resolved
export const getImagePath = (name: string) => {
const slug = slugify(name.replace(/\W+/g, ' '));

return `/previews/${slug.length > 0 ? slug : 'react'}-${PREVIEW_VERSION}.png`;
// const slug = slugify(name.replace(/\W+/g, ' '));
// return `/previews/${slug.length > 0 ? slug : 'react'}-${PREVIEW_VERSION}.png`;
return `/previews/${name}-${PREVIEW_VERSION}.png`;
};

0 comments on commit 00229bf

Please sign in to comment.