Add sitemap (non-code) example
This commit is contained in:
3
examples/sitemap/Makefile
Normal file
3
examples/sitemap/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
.PHONY: build
|
||||
build:
|
||||
protoc -I. --gotemplate_out=template_dir=.:. sitemap.proto
|
12
examples/sitemap/sitemap.proto
Normal file
12
examples/sitemap/sitemap.proto
Normal 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 {}
|
21
examples/sitemap/sitemap.xml
Normal file
21
examples/sitemap/sitemap.xml
Normal 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>
|
9
examples/sitemap/sitemap.xml.tmpl
Normal file
9
examples/sitemap/sitemap.xml.tmpl
Normal 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>
|
Reference in New Issue
Block a user