Skip to main content

Site metadata, favicon, and social card

Quick reference

  • Title/URL/org/project are plain top-level fields in docusaurus.config.js, filled in with this site's own values instead of the template's Docusaurus placeholders.
  • organizationName/projectName only matter for npm run deploy (GitHub Pages) — see Deployment.
  • Social share image: themeConfig.image: 'img/social-card.jpg'.
  • Favicon: favicon: 'img/favicon.ico'.
  • Light/dark toggle: currently off. colorMode.disableSwitch: true hides the navbar toggle. To turn it back on, delete that line (or set it to false).
  • colorMode.respectPrefersColorScheme: true — the site follows the visitor's OS/browser light-dark preference instead of always starting in light mode (the template's default). With the toggle off, this still applies: visitors whose OS is in dark mode get the dark site. To force light mode for everyone, also delete this line. See Color mode.
  • Analytics: gtag.trackingID: 'G-8S1BSK4F9Q', anonymizeIP: true — not present at all in the template.

Core fields​

docusaurus.config.js
title: 'Marla Sowards',
// Plain-text join of taglineItems, for <meta> tags only. See Home page > Hero tagline.
tagline: taglineItems.map((item) => item.text).join(' • '),
url: 'https://www.marlasowards.com',
baseUrl: '/',
organizationName: 'cedar-ave',
projectName: 'portfolio',

title here is the site's actual <title>/metadata title (as opposed to the navbar's separate display title: 'Home' — see Navbar). organizationName and projectName are the GitHub owner/repo npm run deploy pushes to; they don't affect anything else about the build.

Social card​

docusaurus.config.js
themeConfig: {
image: 'img/social-card.jpg',

This is the default Open Graph / Twitter card image used when a page or blog post doesn't set its own image frontmatter — the preview shown when a link to the site is shared on LinkedIn, X, Slack, etc. To update the card image, replace static/img/social-card.jpg (or point image at a new file) — recommended size is 1200×630.

Favicon​

favicon: 'img/favicon.ico',

Resolves to static/img/favicon.ico. Swap that file to change it; no other config needed.

Color mode​

docusaurus.config.js
themeConfig: {
colorMode: {
disableSwitch: true,
respectPrefersColorScheme: true,
},

Neither option is set in the classic template, which means visitors always land in light mode and can switch to dark mode with a toggle in the navbar. Docusaurus remembers that choice per visitor in local storage.

Follow the OS preference​

respectPrefersColorScheme: true makes first-time visitors get whichever mode their OS/browser is already set to, instead of light mode.

Light/dark toggle​

disableSwitch: true removes the light/dark toggle from the navbar. It was added to turn the dark site off for now.

With the toggle off, Docusaurus also ignores any light/dark choice a visitor saved earlier, so returning visitors can't get stuck in a mode they can no longer switch out of. The page's starting mode then comes only from respectPrefersColorScheme:

disableSwitchrespectPrefersColorSchemeResult
truetrue (current)No toggle. Visitors get their OS preference, so OS-dark visitors still see the dark site.
trueremoved or falseNo toggle. Everyone gets light mode (defaultMode, which defaults to 'light').
removed or falsetrueToggle shown. Starts in the OS preference; the visitor's choice is remembered.

To turn the toggle back on, delete the disableSwitch line. To fully disable dark mode, delete respectPrefersColorScheme too. The dark-mode colors in src/css/custom.css ([data-theme='dark'] blocks, see Colors) can stay in place either way; they just go unused while the site is light-only.

Analytics​

docusaurus.config.js
presets: [['classic', {
// ...
gtag: {
trackingID: 'G-8S1BSK4F9Q',
anonymizeIP: true,
},
}]],

Google Analytics (gtag.js), not present in the template at all. anonymizeIP: true strips the last octet of visitor IPs before they reach Analytics. To point this at a different property, swap trackingID; to remove analytics entirely, delete the gtag block.