Features
A sitemap is a special file that helps search engines like Google understand the structure of a website. It’s like a map that shows all the pages on a website and how they’re connected to each other.
Having a sitemap.xml file makes it easier for search engines to find and index their pages. This means that when someone searches for something related to your content, your web application is more likely to appear in the search results.
Elegant is configured right out of the box to generate a sitemap.xml file for your web application automatically.
Below is a snippet of our sitemap for this website.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>https://www.elegantframework.com</loc>
<lastmod>2023-10-10T01:09:58.072Z</lastmod>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://www.elegantframework.com/blog</loc>
<lastmod>2023-10-10T01:09:58.072Z</lastmod>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://www.elegantframework.com/experts</loc>
<lastmod>2023-10-10T01:09:58.072Z</lastmod>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
</urlset>
During local development, a sitemap.xml file will not generated by your application.
By default, npm run dev
will not run certain build steps such as sitemaps, RSS feed generation, and robots.txt creation.
To override this behavior locally, simply run npm run build
and navigate to your /public
directory.
Once you have deployed your Elegant application to your domain, you can view your sitemap by navigating to sitemap.xml
at the root of your domain.
For example: elegantframework.com/sitemap.xml.