BrowserUX Blog

Front-End Development

JS JSON 🔍 SEO

About BrowserUX SEO Files

Logo BrowserUX SEO Files

BrowserUX SEO Files is a modern plugin designed to automate the generation of essential SEO technical files such as sitemap.xml and robots.txt. It integrates seamlessly into the Vite workflow—whether you're building static sites or single-page applications (SPA)—and ensures better indexing by search engines with zero manual effort.

Designed as a standalone and reusable building block, BrowserUX SEO Files goes beyond a simple build script: it automatically detects your pages, handles SPA routes, applies your exclusion rules, and generates files fully optimized for indexing, all with zero manual effort.

Lightweight, written in TypeScript, and fully configurable, it offers a robust solution for implementing SEO best practices in any Vite project, without unnecessary complexity.

I. Why BrowserUX SEO Files?

In many projects, generating sitemap.xml and robots.txt is often done manually: custom scripts, copy-pasting, forgetting to update... The result? Outdated, incomplete, or missing files that hurt SEO indexing.

BrowserUX SEO Files was created to solve this. Instead of repeating the same manual steps with every deployment, this plugin automates and secures the entire process. It integrates into the Vite pipeline (vite build), detects your HTML resources, handles SPA routes, and generates clean, consistent, always up-to-date files.

II. Goals

  • Automatically generate sitemap.xml and robots.txt files at each build
  • Support Vite projects, whether static or SPA-based
  • Enable fine-grained configuration (exclusions, Disallow rules, additional URLs)
  • Dynamically extract routes from a routes-list.js file in SPA projects
  • Detect each page’s last modification date (lastmod)
  • Require no external dependencies or custom logic

III. Key Features

1. Automatic sitemap generation

The plugin scans the dist/ folder after build to list all .html pages, extracting their last modification dates and calculating priorities. It then generates the sitemap.xml file automatically, ready to be read by search engines.


<url>
    <loc>https://example.com/about/</loc>
    <lastmod>2025-07-13</lastmod>
    <priority>0.50</priority>
</url>

2. Smart robots.txt creation

It adds a User-agent: * directive, includes a link to the sitemap, and allows you to define Disallow rules to block specific areas of your site.


User-agent: *
Disallow: /private/
Sitemap: https://example.com/sitemap.xml

3. SPA support with routes-list.js

If a src/routes-list.js file is detected, the plugin uses it to generate a sitemap based on the declared routes. This ensures full support for SPAs, even when no HTML files are directly present in the output.

4. Advanced customization

  • Exclusions: with exclude, you can ignore specific files or folders (e.g. drafts/**, 404.html)
  • Additional URLs: with additionalUrls, you can manually add dynamic or external pages
  • Protected paths: with disallow, you control exactly what bots can and cannot crawl

5. Modern format and broad compatibility

The plugin is compatible with both ESM and CommonJS, works with all Vite frameworks (Vue, React, Svelte…), and requires no external dependencies. It also fully supports TypeScript with native autocompletion.

IV. A stable and scalable foundation

BrowserUX SEO Files is built to be stable, predictable, and easy to maintain. Every option is documented, and the source code is structured to support future enhancements.

The project is open-source, available on GitHub, and welcomes suggestions, contributions, and feedback from the community.

V. Easy to read, quick to configure

The vite.config.js file is all you need to enable the plugin’s core features:


import { defineConfig } from 'vite';
import seoFiles from 'vite-plugin-seo-files';

export default defineConfig({
    plugins: [
        seoFiles({
            siteUrl: 'https://mysite.com',
            exclude: ['404.html', 'drafts/**'],
            disallow: ['/private/', '/admin'],
            additionalUrls: ['/custom-page', '/api/landing']
        })
    ]
});

No additional steps, no HTML to modify, everything is ready as soon as the build is done.

VI. Conclusion

BrowserUX SEO Files addresses a commonly overlooked need in the Vite ecosystem: automating and securing the generation of essential SEO files. It improves indexing, reduces manual errors, and integrates naturally into your build process.

If you're looking for a simple, effective, and scalable solution to handle technical SEO in your Vite projects, give BrowserUX SEO Files a try.

BrowserUX SEO Files is a lightweight, automated, and configurable Vite plugin designed to easily generate the technical SEO files sitemap.xml and robots.txt after each build: BrowserUX SEO Files

About

This blog was designed as a natural extension of the BrowserUX ecosystem projects.

Its goal is to provide complementary resources, focused tips, and detailed explanations around the technical choices, best practices, and accessibility principles that structure these tools.

Each article or tip sheds light on a specific aspect of modern front-end (CSS, accessibility, UX, performance…), with a clear intention: to explain the “why” behind each rule to encourage more thoughtful and sustainable integration in your projects.