From 1d814d893400777619e5f0fcb313844e336e67e4 Mon Sep 17 00:00:00 2001 From: sosolyht Date: Fri, 28 Apr 2023 22:32:39 +0900 Subject: [PATCH] add README.md --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b61c08f --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +[![Go Report Card](https://goreportcard.com/badge/github.com/sosolyht/go-sitemap)](https://goreportcard.com/report/github.com/sosolyht/go-sitemap) +# Go Sitemap Generator + +A flexible library for creating sitemap and google video sitemaps in Go + +## Installation + +```bash +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. + +```go +package main + +import "github.com/sosolyht/go-sitemap/sitemap" + +func main() { +// Create a standard sitemap +s := sitemap.NewSitemap() + + 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. \ No newline at end of file