Skip to content

WildDev/spring-starter-sitemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Sitemap exposure starter for Spring apps.

Java CI with Maven

How to use

  1. Implement fun.wilddev.spring.sitemap.api.SiteMapLoader:
@Component
public class ExampleSiteMapLoader implements SiteMapLoader {

    @Override
    public List<SiteMapEntry> load() {
        return List.of(
                new SiteMapEntry("https://test.website/test_1", LocalDateTime.now()),
                new SiteMapEntry("https://test.website/test_2", LocalDateTime.now()),
                new SiteMapEntry("https://test.website/test_3", LocalDateTime.now())
        );
    }
}
  1. Access the sitemap endpoint by https://test.website/sitemap/xml:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://test.website/test_1</loc>
        <lastmod>2024-11-03T18:24:19Z</lastmod>
    </url>
    <url>
        <loc>https://test.website/test_2</loc>
        <lastmod>2024-11-03T17:11:16Z</lastmod>
    </url>
    <url>
        <loc>https://test.website/test_3</loc>
        <lastmod>2024-11-03T17:54:17Z</lastmod>
    </url>
</urlset>

Get started

Build requirements:

  • latest JDK and Maven

Also available in Maven central:

<dependency>
    <groupId>fun.wilddev.lib</groupId>
    <artifactId>spring-starter-sitemap</artifactId>
    <version>1.0.1.RELEASE</version>
</dependency>

About

Sitemap exposure starter for Spring apps

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages