Provides sitemap.xml support for Gin.
Shamelessly modified clone of gorobots 😬 (originally based on Favicon Middleware for Gin)
Assuming you've already prepared your sitemap.xml
file, you can proceed with the steps below.
Download and install the package
go get https://github.com/dragstor/ginsitemap
Add the following line to your import
section:
import "github.com/dragstor/ginsitemap"
Add the middleware to your router
:
r.Use(ginsitemap.New("./path/to/sitemap/sitemap.xml"))
package main
import (
"github.com/gin-gonic/gin"
"github.com/dragstor/ginsitemap"
)
func main() {
r := gin.Default()
r.Use(ginsitemap.New("./sitemap.xml"))
r.Run(":8080")
}
MIT