Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kataras/sitemap
:new: Sitemap Protocol for Go | https://support.google.com/webmasters/answer/189077?hl=en
https://github.com/kataras/sitemap
go golang protocol sitemap web-development
Last synced: 11 days ago
JSON representation
:new: Sitemap Protocol for Go | https://support.google.com/webmasters/answer/189077?hl=en
- Host: GitHub
- URL: https://github.com/kataras/sitemap
- Owner: kataras
- License: mit
- Created: 2019-12-04T23:44:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-24T06:22:43.000Z (almost 2 years ago)
- Last Synced: 2024-10-14T11:23:55.222Z (25 days ago)
- Topics: go, golang, protocol, sitemap, web-development
- Language: Go
- Homepage: https://www.sitemaps.org/protocol.html
- Size: 22.5 KB
- Stars: 19
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- go-awesome - Sitemap - sitemap.xml generation (Open source library / Word Processing)
README
# Sitemap (Go)
[![build status](https://img.shields.io/github/actions/workflow/status/kataras/sitemap/ci.yml?style=for-the-badge)](https://github.com/kataras/sitemap/actions) [![report card](https://img.shields.io/badge/report%20card-a%2B-ff3333.svg?style=for-the-badge)](https://goreportcard.com/report/github.com/kataras/sitemap) [![godocs](https://img.shields.io/badge/go-%20docs-488AC7.svg?style=for-the-badge)](https://pkg.go.dev/github.com/kataras/sitemap)
[Sitemap Protocol](https://www.sitemaps.org/protocol.html) implementation for Go. Automatically handles [Sitemap index files](https://www.sitemaps.org/protocol.html#index) `"/sitemap.xml"`.
## Getting started
The only requirement is the [Go Programming Language](https://golang.org/dl).
```sh
$ go get github.com/kataras/sitemap
``````go
import "github.com/kataras/sitemap"
``````go
sitemaps := sitemap.New("http://localhost:8080").
URL(sitemap.URL{Loc: "/home"}).
URL(sitemap.URL{Loc: "/articles", LastMod: time.Now(), ChangeFreq: sitemap.Daily, Priority: 1}).
Build()
``````go
import "net/http"
``````go
for _, s := range sitemaps {
http.Handle(s.Path, s)
}http.ListenAndServe(":8080", nil)
```Visit http://localhost:8080/sitemap.xml
```xml
http://localhost:8080/home
http://localhost:8080/articles
2019-12-05T08:17:35+02:00
daily
1
```
For a more detailed technical documentation you can head over to our [godocs](https://godoc.org/github.com/kataras/sitemap). And for executable code you can always visit the [_examples](_examples) repository's subdirectory.
## License
kataras/sitemap is free and open-source software licensed under the [MIT License](https://tldrlegal.com/license/mit-license).