Skip to content

Commit

Permalink
updated docusaurus config with open-graph image and metadata (#1345)
Browse files Browse the repository at this point in the history
  • Loading branch information
barret-anspach authored Jan 9, 2025
1 parent 07667fc commit 7ce7bcf
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 8 deletions.
68 changes: 60 additions & 8 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
const lightTheme = require('./src/utils/prismLight.js');
const darkTheme = require('./src/utils/prismDark.js');

const title = 'Spectacle';
const subtitle = `${title} - React library for sleek presentations, using JSX syntax`;
const tagline =
'A React.js based library for creating sleek presentations using JSX syntax that gives you the ability to live demo your code.';

async function createConfig() {
/** @type {import("@docusaurus/types").Config} */
const config = {
title: 'Spectacle',
tagline:
'A React.js based library for creating sleek presentations using JSX syntax that gives you the ability to live demo your code.',
title,
tagline,
url: 'https://commerce.nearform.com/',
baseUrl:
process.env.VERCEL_ENV === 'preview' ? '/' : '/open-source/spectacle',
Expand All @@ -17,7 +21,6 @@ async function createConfig() {
favicon: 'img/favicon.ico',
organizationName: 'Nearform Commerce',
projectName: 'spectacle',

presets: [
[
'@docusaurus/preset-classic',
Expand Down Expand Up @@ -57,7 +60,6 @@ async function createConfig() {
})
]
],

plugins: [
'docusaurus-plugin-sass',
[
Expand All @@ -72,7 +74,6 @@ async function createConfig() {
}
]
],

themeConfig:
/** @type {import("@docusaurus/preset-classic").ThemeConfig} */
({
Expand Down Expand Up @@ -115,7 +116,59 @@ async function createConfig() {
},
copyright: `Copyright © ${new Date().getFullYear()} Nearform`
},
prism: {} // Keep empty object so we can add prism themes below
prism: {}, // Keep empty object so we can add prism themes below
metadata: [
{
name: 'title',
content: subtitle
},
{
name: 'description',
content: tagline
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1, maximum-scale=1'
},
{
property: 'og:type',
content: 'website'
},
{
property: 'og:url',
content: 'https://commerce.nearform.com/open-source/spectacle/'
},
{
property: 'og:title',
content: subtitle
},
{
property: 'og:description',
content: tagline
},
{
property: 'og:image',
content:
'https://commerce.nearform.com/open-source/spectacle/open-graph.png'
},
{
property: 'twitter:card',
content: 'summary_large_image'
},
{
property: 'twitter:title',
content: subtitle
},
{
property: 'twitter:description',
content: tagline
},
{
property: 'twitter:image',
content:
'https://commerce.nearform.com/open-source/spectacle/open-graph.png'
}
]
})
};

Expand All @@ -125,5 +178,4 @@ async function createConfig() {
config.themeConfig.prism.darkTheme = darkTheme;
return config;
}

module.exports = createConfig;
Binary file added website/static/open-graph.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 7ce7bcf

Please sign in to comment.