Skip to content

Globals

Globals are singleton configurations in Payload CMS. Unlike collections (which have many items), each global exists as a single document. They are perfect for site-wide settings.

Overview

Portfolio CMS includes four globals:

GlobalPurposeLocation
Site SettingsGeneral configurationSettings > Site Settings
ProfileYour personal infoContent > Profile
NavigationMenu configurationSettings > Navigation
FooterFooter configurationSettings > Footer

Site Settings

Central configuration for your entire portfolio.

General Tab

FieldDescription
Site NameYour portfolio/brand name
Site TaglineShort description or motto
LogoSite logo image
Logo TextFallback text if no logo
FaviconBrowser tab icon (32x32 recommended)

Contact Tab

FieldDescription
EmailYour contact email
PhonePhone number
LocationCity, country
AvailabilityStatus like "Available for freelance"

Add your social media profiles:

Platform Options
GitHub, LinkedIn, Twitter/X
Instagram, YouTube, Dribbble
Behance, CodePen, Dev.to
Medium, Substack, Discord
Twitch, Website

Each social link has:

  • Platform - Select from list
  • URL - Profile URL
  • Label - Optional custom label

CTA Tab

Configure call-to-action buttons:

FieldDescription
Primary CTA LabelButton text (e.g., "Get in Touch")
Primary CTA URLButton link
Secondary CTA LabelSecond button text
Secondary CTA URLSecond button link
Resume URLLink to resume download

SEO Defaults Tab

Default meta information:

FieldDescription
Meta TitleTitle template (use %s for page title)
Meta DescriptionDefault site description
OG ImageDefault social sharing image
Twitter HandleYour @username

Features Tab

Toggle site features:

FeatureDescription
Enable Dark ModeShow theme toggle
Enable SearchShow search functionality
Enable Project FiltersShow category filters
Enable AnimationsShow page animations
Show Scroll ProgressShow reading progress bar

Analytics Tab

FieldDescription
Google Analytics IDGA Measurement ID (G-XXXXXXXX)
Head ScriptsCustom scripts for <head>
Body ScriptsCustom scripts before </body>

Profile

Your personal information displayed across the site.

Basic Info Tab

FieldDescription
NameYour full name
TitleProfessional title
TaglineCatchy one-liner
BioBrief introduction
AvatarProfile photo

About Tab

FieldDescription
About TitleSection heading
About ContentRich text about you
About ImageImage for about section
HighlightsKey facts (label/value pairs)

Example highlights:

  • "Experience" / "5+ Years"
  • "Location" / "San Francisco"
  • "Focus" / "Full Stack"

Stats Tab

Add impressive metrics:

FieldDescription
LabelStat description
ValueThe number/text
IconVisual icon

Example stats:

  • "Years Experience" / "5+" / Briefcase icon
  • "Projects" / "50+" / Code icon
  • "Happy Clients" / "30+" / Users icon

Services Tab

Services you offer:

FieldDescription
Services TitleSection heading
Services DescriptionSection intro
ServicesArray of services

Each service has:

  • Title - Service name
  • Description - What it includes
  • Icon - Visual icon

Resume Tab

FieldDescription
Resume FileUpload PDF resume
Resume URLOr link to external resume

Configure the site navigation menu.

Array of menu links:

FieldDescription
LabelMenu text
URLLink destination
HighlightStyle as button
Open in New TabExternal link behavior

Example configuration:

- Home → /
- Projects → /projects
- About → /#about
- Contact → /#contact (highlighted)

CTA Button

FieldDescription
Show CTADisplay button in navbar
CTA LabelButton text
CTA URLButton destination

Configure the site footer.

Organize links into columns:

FieldDescription
TitleColumn heading
LinksArray of links

Each link has:

  • Label - Link text
  • URL - Destination
  • Open in New Tab - External behavior

Example structure:

Column 1: Navigation
- Home → /
- Projects → /projects
- About → /#about

Column 2: Connect
- GitHub → https://github.com/...
- LinkedIn → https://linkedin.com/...

Additional Settings

FieldDescription
Show Social LinksDisplay icons from Site Settings
Copyright TextFooter copyright (use {year} for current year)
Bottom LinksPrivacy policy, terms, etc.

Accessing Globals in Code

Server Components

typescript
import { getPayload } from 'payload'
import config from '@payload-config'

export default async function Layout({ children }) {
  const payload = await getPayload({ config })

  const settings = await payload.findGlobal({
    slug: 'site-settings',
  })

  const navigation = await payload.findGlobal({
    slug: 'navigation',
  })

  return (
    <html>
      <body>
        <Navbar navigation={navigation} settings={settings} />
        {children}
        <Footer settings={settings} />
      </body>
    </html>
  )
}

Using Helper Functions

typescript
import { getSiteSettings, getProfile, getNavigation, getFooter } from '@/lib/payload'

// Fetch multiple globals in parallel
const [settings, profile, navigation, footer] = await Promise.all([
  getSiteSettings(),
  getProfile(),
  getNavigation(),
  getFooter(),
])

Type Safety

All globals are fully typed:

typescript
import type { SiteSettings, Profile, Navigation, Footer } from '@/payload-types'

function Navbar({ settings }: { settings: SiteSettings }) {
  return (
    <nav>
      <Logo src={settings.logo} text={settings.logoText} />
      {/* ... */}
    </nav>
  )
}

Released under the MIT License.