Skip to content

Go sitemap generator A flexible library for creating sitemap and google video sitemaps in Go

License

Notifications You must be signed in to change notification settings

sosolyht/go-sitemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card

Go Sitemap Generator

A flexible library for creating sitemap and google video sitemaps in Go

Installation

go get -u github.com/sosolyht/go-sitemap/sitemap

Usage

Here is an example of how to use the Go Sitemap Generator library to create both standard and video sitemaps.

package main

import "github.com/sosolyht/go-sitemap/sitemap"

func main() {
// Create a sitemap with path
s := sitemap.NewSitemap().Path("util/sitemaps")

	links := []string{
		"https://google.com",
		"https://naver.com",
	}
	for _, link := range links {
		s.AddURL(link)
	}

	// Create a video sitemap
	vs := sitemap.NewVideoSitemap()

	videoURLs := []sitemap.VideoURL{
		// ... (the example video URLs)
	}

	for _, videoURL := range videoURLs {
		vs.AddVideoURL(videoURL)
	}
}

Replace the videoURLs variable with your video URLs and their respective video information. The sitemaps will be generated and saved as sitemaps/sitemap.xml and sitemaps/sitemap_video.xml respectively.

About

Go sitemap generator A flexible library for creating sitemap and google video sitemaps in Go

Topics

Resources

License

Stars

Watchers

Forks

Languages