-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module github.com/webhunger-ch/snack | ||
module github.com/bytehunger/snack | ||
|
||
go 1.18 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
package main | ||
|
||
import "net/url" | ||
|
||
type Page struct { | ||
Title string `yaml:"title"` | ||
Path string `yaml:"path"` | ||
Description string `yaml:"description"` | ||
Sections []Section `yaml:"sections"` | ||
NoIndex bool `yaml:"noIndex" json:"noIndex"` | ||
} | ||
|
||
// Assemble the complete URL for the page with given domain. | ||
func (p *Page) URL(host string) string { | ||
url, err := url.Parse(host) | ||
|
||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
url.Path = p.Path | ||
|
||
return url.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package sitemap | ||
|
||
import "encoding/xml" | ||
|
||
type URL struct { | ||
XMLName xml.Name `xml:"url"` | ||
Loc string `xml:"loc"` | ||
ChangeFreq string `xml:"changefreq,omitempty"` | ||
LastMod string `xml:"lastmod,omitempty"` | ||
Priority string `xml:"priority,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package sitemap | ||
|
||
import "encoding/xml" | ||
|
||
type URLSet struct { | ||
XMLName xml.Name `xml:"urlset"` | ||
XMLNS string `xml:"xmlns,attr"` | ||
URLs []URL `xml:"url"` | ||
} |