# Sitemap Entry

> XML sitemap URL entry with lastmod, changefreq, and priority.

- Name: `sitemap-entry`
- Categories: seo
- Detail page: https://open-types.dev/types/sitemap-entry

## Install

```bash
# Types only
npx shadcn add @open-types/sitemap-entry

# Types + Zod v4 validators
npx shadcn add @open-types/sitemap-entry-zod

# Types + real-world examples
npx shadcn add @open-types/sitemap-entry-examples
```

## Types

```typescript
export type SitemapChangeFreq =
  | "always"
  | "hourly"
  | "daily"
  | "weekly"
  | "monthly"
  | "yearly"
  | "never";

export interface SitemapEntry {
  loc: string;
  lastmod?: string;
  changefreq?: SitemapChangeFreq;
  priority?: number;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type { SitemapChangeFreq, SitemapEntry } from "../types/sitemap-entry";

export const sitemapChangeFreqSchema = z.enum([
  "always",
  "hourly",
  "daily",
  "weekly",
  "monthly",
  "yearly",
  "never",
]) satisfies z.ZodType<SitemapChangeFreq>;

export const sitemapEntrySchema = z.object({
  loc: z.string(),
  lastmod: z.string().optional(),
  changefreq: sitemapChangeFreqSchema.optional(),
  priority: z
    .number()
    .min(0, { error: "Priority must be between 0.0 and 1.0" })
    .max(1, { error: "Priority must be between 0.0 and 1.0" })
    .optional(),
}) satisfies z.ZodType<SitemapEntry>;

export type { SitemapChangeFreq, SitemapEntry } from "../types/sitemap-entry";
```

## Examples

```typescript
// Source: https://www.sitemaps.org/protocol.html
// Captured: 2026-05
import type {
  SitemapChangeFreq,
  SitemapEntry,
} from "../types/sitemap-entry";

export const sitemapChangeFreqExamples = {
  always: "always",
  hourly: "hourly",
  daily: "daily",
  weekly: "weekly",
  monthly: "monthly",
  yearly: "yearly",
  never: "never",
} as const satisfies Record<string, SitemapChangeFreq>;

export const sitemapEntryExamples = {
  homepage: {
    loc: "https://open-types.dev/",
    lastmod: "2026-05-16",
    changefreq: "daily",
    priority: 1.0,
  } satisfies SitemapEntry,
  article: {
    loc: "https://open-types.dev/blog/why",
    lastmod: "2026-04-13T18:30:00+00:00",
    changefreq: "monthly",
    priority: 0.6,
  } satisfies SitemapEntry,
  staticPage: {
    loc: "https://open-types.dev/about",
    lastmod: "2025-12-01",
    changefreq: "yearly",
    priority: 0.4,
  } satisfies SitemapEntry,
  minimal: { loc: "https://open-types.dev/legal" } satisfies SitemapEntry,
  archived: {
    loc: "https://open-types.dev/v1",
    changefreq: "never",
    priority: 0.1,
  } satisfies SitemapEntry,
} as const;
```
