Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 921 Bytes

README.md

File metadata and controls

50 lines (35 loc) · 921 Bytes

sitemap.xml Gin Middleware

Provides sitemap.xml support for Gin.

Shamelessly modified clone of gorobots 😬 (originally based on Favicon Middleware for Gin)

Usage

Assuming you've already prepared your sitemap.xml file, you can proceed with the steps below.

Step 1

Download and install the package

go get https://github.com/dragstor/ginsitemap

Step 2

Add the following line to your import section:

import "github.com/dragstor/ginsitemap"

Step 3

Add the middleware to your router:

r.Use(ginsitemap.New("./path/to/sitemap/sitemap.xml"))

Example Code

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")
}

License

MIT