mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
@@ -791,6 +791,17 @@ func (p *Page) Extension() string {
|
|||||||
return p.extension
|
return p.extension
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasShortcode return whether the page has a shortcode with the given name.
|
||||||
|
// This method is mainly motivated with the Hugo Docs site's need for a list
|
||||||
|
// of pages with the `todo` shortcode in it.
|
||||||
|
func (p *Page) HasShortcode(name string) bool {
|
||||||
|
if p.shortcodeState == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return p.shortcodeState.nameSet[name]
|
||||||
|
}
|
||||||
|
|
||||||
// AllTranslations returns all translations, including the current Page.
|
// AllTranslations returns all translations, including the current Page.
|
||||||
func (p *Page) AllTranslations() Pages {
|
func (p *Page) AllTranslations() Pages {
|
||||||
return p.translations
|
return p.translations
|
||||||
|
@@ -254,6 +254,9 @@ Content: {{ .Content }}
|
|||||||
require.Equal(t, "webcal://example.com/blog/index.ics", cal.Permalink())
|
require.Equal(t, "webcal://example.com/blog/index.ics", cal.Permalink())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require.True(t, home.HasShortcode("myShort"))
|
||||||
|
require.False(t, home.HasShortcode("doesNotExist"))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #3447
|
// Issue #3447
|
||||||
|
Reference in New Issue
Block a user