Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dragstor/ginsitemap
A simple sitemap.xml middleware for gin-gonic framework.
https://github.com/dragstor/ginsitemap
gin gin-framework gin-gonic golang middleware sitemap sitemap-xml
Last synced: 19 days ago
JSON representation
A simple sitemap.xml middleware for gin-gonic framework.
- Host: GitHub
- URL: https://github.com/dragstor/ginsitemap
- Owner: dragstor
- License: mit
- Created: 2021-12-30T06:39:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-07T07:53:00.000Z (almost 3 years ago)
- Last Synced: 2024-11-15T22:23:04.781Z (about 1 month ago)
- Topics: gin, gin-framework, gin-gonic, golang, middleware, sitemap, sitemap-xml
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sitemap.xml Gin Middleware
Provides sitemap.xml support for Gin.Shamelessly modified clone of [gorobots](https://github.com/vasiliyaltunin/gorobots) :grimacing: (originally based on [Favicon Middleware for Gin](https://github.com/thinkerou/favicon))
# 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:```go
import "github.com/dragstor/ginsitemap"
```## Step 3
Add the middleware to your `router`:
```go
r.Use(ginsitemap.New("./path/to/sitemap/sitemap.xml"))
```# Example Code
```go
package mainimport (
"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