Skip to content

Commit

Permalink
Merge pull request #25 from buddhamagnet/cleanup-docs
Browse files Browse the repository at this point in the history
clean up README
  • Loading branch information
ikeikeikeike committed Oct 28, 2018
2 parents b872633 + b466269 commit e033eb3
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions README.md
Expand Up @@ -13,8 +13,8 @@ import (
func main() { func main() {
sm := stm.NewSitemap() sm := stm.NewSitemap()


// Create method must be that calls first this method in that before // Create method must be called first before adding entries to
// call to Add method on this struct. // the sitemap.
sm.Create() sm.Create()


sm.Add(stm.URL{"loc": "home", "changefreq": "always", "mobile": true}) sm.Add(stm.URL{"loc": "home", "changefreq": "always", "mobile": true})
Expand All @@ -25,11 +25,7 @@ func main() {
} }
``` ```


Sitemap provides interface for create sitemap xml file and that has convenient interface. ### Installation
And also needs to use first Sitemap struct if it wants to use this package.


### Installing


```console ```console
$ go get github.com/ikeikeikeike/go-sitemap-generator/stm $ go get github.com/ikeikeikeike/go-sitemap-generator/stm
Expand All @@ -47,10 +43,9 @@ Current Features or To-Do
- [x] [Mobile sitemaps](#mobile-sitemaps) - [x] [Mobile sitemaps](#mobile-sitemaps)
- [ ] PageMap sitemap - [ ] PageMap sitemap
- [ ] Alternate Links - [ ] Alternate Links
- [ ] Supports: write some kind of filesystem and object storage. - [ ] Supports: adapters for sitemap storage.
- [x] Filesystem - [x] Filesystem
- [x] [S3](#upload-sitemap-to-s3) - [x] [S3](#upload-sitemap-to-s3)
- [ ] Some adapter
- [x] [Customizable sitemap working](#preventing-output) - [x] [Customizable sitemap working](#preventing-output)
- [x] [Notifies search engines (Google, Bing) of new sitemaps](#pinging-search-engines) - [x] [Notifies search engines (Google, Bing) of new sitemaps](#pinging-search-engines)
- [x] [Gives you complete control over your sitemap contents and naming scheme](#full-example) - [x] [Gives you complete control over your sitemap contents and naming scheme](#full-example)
Expand All @@ -60,8 +55,8 @@ Current Features or To-Do


### Preventing Output ### Preventing Output


To disable all non-essential output you can give `false` to `sm.SetVerbose`. To disable all non-essential output you can set `sm.SetVerbose` to `false`.
To disable output in-code use the following: To disable output inline use the following:


```go ```go
sm := stm.NewSitemap() sm := stm.NewSitemap()
Expand All @@ -70,13 +65,14 @@ sm.SetVerbose(false)


### Pinging Search Engines ### Pinging Search Engines


PingSearchEngines requests some ping server. PingSearchEngines notifies search engines of changes once a sitemap
has been generated or changed. The library will append Google and Bing to any engines passed in to the function.


```go ```go
sm.Finalize().PingSearchEngines() sm.Finalize().PingSearchEngines()
``` ```


If you want to add `new search engine`, you can set that to method's arguments. like this. If you want to add `new search engine`, you can pass that in to the function:


```go ```go
sm.Finalize().PingSearchEngines("http://newengine.com/ping?url=%s") sm.Finalize().PingSearchEngines("http://newengine.com/ping?url=%s")
Expand All @@ -100,7 +96,7 @@ sm.SetSitemapsPath("sitemaps/")
// Struct of `S3Adapter` // Struct of `S3Adapter`
sm.SetAdapter(&stm.S3Adapter{Region: "ap-northeast-1", Bucket: "your-bucket", ACL: "public-read"}) sm.SetAdapter(&stm.S3Adapter{Region: "ap-northeast-1", Bucket: "your-bucket", ACL: "public-read"})


// It changes to output filename // Change the output filename
sm.SetFilename("new_filename") sm.SetFilename("new_filename")
``` ```


Expand Down Expand Up @@ -193,7 +189,7 @@ sm.Add(stm.URL{"loc": "/geos", "geo": stm.URL{
}}) }})
``` ```


Couldn't find Geo sitemaps example. Although its like a below. Couldn't find Geo sitemaps example, although it's similar to:


```xml ```xml
<url> <url>
Expand Down Expand Up @@ -295,7 +291,7 @@ func buildSitemap() *stm.Sitemap {
sm.Add(stm.URL{"loc": "/", "changefreq": "daily"}) sm.Add(stm.URL{"loc": "/", "changefreq": "daily"})


// Note: Do not call `sm.Finalize()` because it flushes // Note: Do not call `sm.Finalize()` because it flushes
// the underlying datastructure from memory to disk. // the underlying data structure from memory to disk.


return sm return sm
} }
Expand All @@ -320,15 +316,15 @@ func main() {
- [API Reference](https://godoc.org/github.com/ikeikeikeike/go-sitemap-generator/stm) - [API Reference](https://godoc.org/github.com/ikeikeikeike/go-sitemap-generator/stm)
- [sitemap_generator](http://github.com/kjvarga/sitemap_generator) - [sitemap_generator](http://github.com/kjvarga/sitemap_generator)


### How to testing ### How to test.


Prepare testing Preparation:


```console ```console
$ go get github.com/clbanning/mxj $ go get github.com/clbanning/mxj
``` ```


Do testing Run tests:


```console ```console
$ go test -v -cover -race ./... $ go test -v -cover -race ./...
Expand Down

0 comments on commit e033eb3

Please sign in to comment.