mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 13:40:38 +03:00
Add custom protocol support in Permalink
This commit is contained in:
parent
8bcc08e3b0
commit
d851d6b98f
9 changed files with 171 additions and 37 deletions
|
@ -52,7 +52,7 @@ func TestDefaultOutputFormats(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSiteWithPageOutputs(t *testing.T) {
|
||||
for _, outputs := range [][]string{{"html", "json"}, {"json"}} {
|
||||
for _, outputs := range [][]string{{"html", "json", "calendar"}, {"json"}} {
|
||||
t.Run(fmt.Sprintf("%v", outputs), func(t *testing.T) {
|
||||
doTestSiteWithPageOutputs(t, outputs)
|
||||
})
|
||||
|
@ -146,4 +146,12 @@ Output/Rel: {{ .Name -}}/{{ .Rel }}|
|
|||
require.Equal(t, "/blog/index.json", json.RelPermalink())
|
||||
require.Equal(t, "http://example.com/blog/index.json", json.Permalink())
|
||||
|
||||
if helpers.InStringArray(outputs, "cal") {
|
||||
// TODO(bep) output have do some protocil handling for the default too if set.
|
||||
cal := of.Get("calendar")
|
||||
require.NotNil(t, cal)
|
||||
require.Equal(t, "/blog/index.ics", cal.RelPermalink())
|
||||
require.Equal(t, "webcal://example.com/blog/index.ics", cal.Permalink())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue