Add sitemap (non-code) example

This commit is contained in:
Manfred Touron 2017-03-16 17:47:54 +01:00
parent 266d42dc25
commit 024c5a4e4e
5 changed files with 46 additions and 0 deletions

View File

@ -12,6 +12,7 @@ test: build
cd examples/flow && make
cd examples/concat && make
cd examples/flow && make
cd examples/sitemap && make
cd examples/go-kit && make
.PHONY: docker.build

View File

@ -0,0 +1,3 @@
.PHONY: build
build:
protoc -I. --gotemplate_out=template_dir=.:. sitemap.proto

View File

@ -0,0 +1,12 @@
syntax = "proto3";
package sitemap;
service DummyService {
rpc Posts(Request) returns (Response) {}
rpc Authors(Request) returns (Response) {}
rpc Comments(Request) returns (Response) {}
}
message Request {}
message Response {}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>/posts</loc>
<priority>0.5</priority>
<changefreq>monthly</changefreq>
<lastmod>2017-03-16</lastmod>
</url>
<url>
<loc>/authors</loc>
<priority>0.5</priority>
<changefreq>monthly</changefreq>
<lastmod>2017-03-16</lastmod>
</url>
<url>
<loc>/comments</loc>
<priority>0.5</priority>
<changefreq>monthly</changefreq>
<lastmod>2017-03-16</lastmod>
</url>
</urlset>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{{range .Service.Method}}
<url>
<loc>/{{.Name | lower}}</loc>
<priority>0.5</priority>
<changefreq>monthly</changefreq>
<lastmod>{{now | date "2006-01-02"}}</lastmod>
</url>{{end}}
</urlset>