Design an XML sitemap portfolio: index, news, image, video, hreflang variants, and…
- User
Design an XML sitemap portfolio: index, news, image, video, hreflang variants, and regeneration SLAs.
Assistant
The user wants an XML sitemap portfolio design. This portfolio needs to cover several specific types of sitemaps:
- Index: The main container for other sitemaps.
- News: For Google News specific content.
- Image: For image-heavy content.
- Video: For video content.
- Hreflang variants: For multilingual/multiregional sites.
- Regeneration SLAs: This isn't an XML tag, but a business logic/policy aspect that needs to be defined alongside the technical design.
Goal: Create a structured, valid XML example and a policy framework for a hypothetical website (let's call it "TechHub") to demonstrate how these elements fit together.
Key XML Namespaces needed:
- Standard Sitemap:
http://www.sitemaps.org/schemas/sitemap/0.9 - Image:
http://www.google.com/schemas/sitemap-image/1.1 - Video:
http://www.google.com/schemas/sitemap-video/1.1 - News:
http://www.google.com/schemas/sitemap-news/0.9 - Xhtml (for hreflang):
http://www.w3.org/1999/xhtml
Structure of the Response:
- Overview: Briefly explain the architecture.
- The Sitemap Index: The root file pointing to the sub-sitemaps.
- Standard + Hreflang Sitemap: A standard page map with multilingual support.
- Image Sitemap: Focusing on visual assets.
- Video Sitemap: Focusing on multimedia.
- News Sitemap: Specific for fresh news articles.
- Regeneration SLA Policy: Defining how often these update.
Drafting the XML Content (Mental Check):
- Index: Just a list of
<sitemap>tags with<loc>. - Hreflang: Needs
<xhtml:link rel="alternate" hreflang="en" href="..."/>inside a standard<url>. - Image: Inside
<url>, use<image:image>-><image:loc>. - Video: Inside
<url>, use<video:video>-><video:thumbnail_loc>,<video:title>, etc. - News: Inside
<url>, use<news:news>-><news:publication_date>,<news:title>.
Refining the "Regeneration SLA" part: This needs to be a table or a list defining frequencies (e.g., News = real-time/15 mins, Static pages = Weekly).
Tone: Professional, technical, and structured.
Let's assemble the XML examples.
-
Index:
<sitemapindex> <sitemap><loc>https://example.com/sitemap_pages.xml</loc></sitemap> <sitemap><loc>https://example.com/sitemap_news.xml</loc></sitemap> ... </sitemapindex> -
Hreflang:
<url> <loc>https://example.com/en/product</loc> <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/product"/> </url> -
Video:
<url> <loc>https://example.com/video-page</loc> <video:video> <video:thumbnail_loc>...</video:thumbnail_loc> <video:title>...</video:title> </video:video> </url> -
News: Constraint: Google News sitemaps should only contain URLs from the last 48 hours. This is a crucial detail to mention.
Final Review of Requirements:
- Index? Yes.
- News? Yes.
- Image? Yes.
- Video? Yes.
- Hreflang? Yes.
- Regeneration SLAs? Yes.
I will structure the response as a "System Design & Implementation Guide".
Self-Correction/Refinement during drafting:
- Make sure to declare all namespaces correctly in the code blocks so they are copy-paste ready (or at least valid).
- Ensure the distinction between a sitemap containing images and a sitemap just for images. Usually, images are embedded in page sitemaps. I will show them embedded in a standard page entry as per best practices.
- For News, emphasize the specific restrictions (last 48 hours).
Let's write it out. Here is a comprehensive design for an XML Sitemap Portfolio architecture. This design separates content types into specific files for better crawl efficiency and indexation control, managed by a central Sitemap Index.
All XML files must be UTF-8 encoded.
1. Architecture Overview
This portfolio uses a Sitemap Index to point to four distinct sub-sitemaps:
- Main (Pages + Hreflang): For core landing pages and internationalization.
- News: For time-sensitive journalistic content (last 48 hours).
- Image: For galleries or heavy visual content.
- Video: For multimedia content.
2. The Sitemap Index (Root)
This is the single file submitted to search engines (e.g.,
/sitemap.xml). It manages the "last modified" discovery for the entire domain.<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <!-- Core Pages & Internationalization --> <sitemap> <loc>https://www.example.com/sitemaps/sitemap_main.xml</loc> <lastmod>2023-10-27</lastmod> </sitemap> <!-- Google News Feed --> <sitemap> <loc>https://www.example.com/sitemaps/sitemap_news.xml</loc> <lastmod>2023-10-27T14:00:00Z</lastmod> </sitemap> <!-- Image Rich Content --> <sitemap> <loc>https://www.example.com/sitemaps/sitemap_images.xml</loc> <lastmod>2023-10-26</lastmod> </sitemap> <!-- Video Rich Content --> <sitemap> <loc>https://www.example.com/sitemaps/sitemap_videos.xml</loc> <lastmod>2023-10-25</lastmod> </sitemap> </sitemapindex>
3. Sitemap: Main Pages & Hreflang
Used for the core website structure. This example demonstrates a single page that has variants in English (default), Spanish, and French.
File:
sitemap_main.xml<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url> <!-- The canonical URL --> <loc>https://www.example.com/en/products/widget</loc> <!-- Last modification time (W3C Datetime) --> <lastmod>2023-10-27T10:30:00+00:00</lastmod> <!-- Frequency is a hint, not a command --> <changefreq>weekly</changefreq> <!-- Hreflang Variants --> <!-- English (Default/Canonical) pointing to itself is optional but good practice --> <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/products/widget"/> <!-- Spanish Variant --> <xhtml:link rel="alternate" hreflang="es" href="https://www.example.com/es/productos/widget"/> <!-- French Variant --> <xhtml:link rel="alternate" hreflang="fr" href="https://www.example.com/fr/produits/widget"/> <!-- Generic "x-default" for unmatched regions --> <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/en/products/widget"/> </url> </urlset>
4. Sitemap: News
News sitemaps are distinct. They should only contain articles published in the last 48 hours. They allow for specific metadata like title, publication name, and genre.
File:
sitemap_news.xml<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"> <url> <loc>https://www.example.com/news/tech-giants-merge</loc> <news:news> <news:publication> <news:name>The Example Times</news:name> <news:language>en</news:language> </news:publication> <news:publication_date>2023-10-27T09:00:00Z</news:publication_date> <news:title>Tech Giants Announce Landmark Merger</news:title> <!-- Optional but recommended --> <news:keywords>business, technology, mergers</news:keywords> <news:genres>PressRelease, Blog</news:genres> <news:stock_tickers>NASDAQ:EXAM</news:stock_tickers> </news:news> </url> </urlset>
5. Sitemap: Image
While you can include images in the main sitemap, for portfolios or photography sites, a dedicated sitemap (or section) listing the image-specific tags helps search engines understand licensing and subject matter.
File:
sitemap_images.xml<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"> <url> <loc>https://www.example.com/gallery/autumn-leaves</loc> <!-- Image 1 --> <image:image> <image:loc>https://cdn.example.com/images/red-leaves.jpg</image:loc> <image:caption>Red autumn leaves in Central Park</image:caption> <image:geo_location>New York, NY</image:geo_location> <image:title>Autumn in the Park</image:title> <image:license>https://creativecommons.org/licenses/by/4.0/</image:license> </image:image> <!-- Image 2 (Multiple images per page allowed) --> <image:image> <image:loc>https://cdn.example.com/images/yellow-leaves.jpg</image:loc> <image:caption>Yellow maple leaves</image:caption> </image:image> </url> </urlset>
6. Sitemap: Video
Video sitemaps are crucial for appearing in Google Video Search and require specific tags like duration and thumbnail.
File:
sitemap_videos.xml<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"> <url> <loc>https://www.example.com/tutorials/how-to-bake</loc> <video:video> <video:thumbnail_loc>https://cdn.example.com/thumbs/bake-thumb.jpg</video:thumbnail_loc> <video:title>How to Bake a Chocolate Cake</video:title> <video:description>A step-by-step guide to baking the perfect cake.</video:description> <!-- Location of the video file itself (optional but recommended) --> <video:content_loc>https://cdn.example.com/video/bake.mp4</video:content_loc> <!-- OR if using a platform like YouTube --> <!-- <video:player_loc>https://www.youtube.com/watch?v=12345</video:player_loc> --> <video:duration>600</video:duration> <!-- Seconds (max 28800) --> <video:publication_date>2023-10-20T08:00:00Z</video:publication_date> <video:uploader info="https://www.example.com/user/chef">Chef Example</video:uploader> <!-- YES/NO/Defer --> <video:family_friendly>yes</video:family_friendly> <!-- Pricing info if it is paid content --> <video:price currency="USD">0.00</video:price> </video:video> </url> </urlset>
7. Regeneration SLA Policy
This section defines the Service Level Agreements (SLAs) for the automated generation and serving of these files. This ensures search engines always receive fresh data without overloading the server.
Sitemap Type Regeneration Strategy SLA (Time to Update) Scope & Logic Sitemap Index On Demand < 5 seconds Regenerates only when any sub-sitemap file is updated/pushed to storage. Main / Hreflang Daily / Batch 02:00 AM UTC Regenerates nightly to capture page updates. lastmodis pulled from the CMS "Last Updated" field.News Real-time / Event < 15 minutes Hooked to CMS "Publish" event. If the article count exceeds 1,000, sitemap pagination is triggered. Purge: Entries > 48 hours are removed automatically. Image / Video Weekly Sunday 03:00 AM UTC Heavy processing; regenerated weekly. lastmodupdated only if asset binary changes (checksum validation).Server Headers Requirements
To ensure the SLAs are valid, the server must serve these files with specific headers:
- Cache-Control:
public, max-age=3600(News),public, max-age=86400(Main/Images). - Content-Type:
application/xmlortext/xml. - Compression: Files > 1MB must be served as
.xml.gz.