Add MediaType and a crude implementation

See #2828
This commit is contained in:
Bjørn Erik Pedersen
2017-03-02 15:35:25 +01:00
parent 9262c5b32f
commit c4989c39f1
4 changed files with 106 additions and 13 deletions

View File

@@ -38,6 +38,7 @@ import (
"github.com/spf13/cast"
bp "github.com/spf13/hugo/bufferpool"
"github.com/spf13/hugo/media"
"github.com/spf13/hugo/source"
)
@@ -199,6 +200,10 @@ type Page struct {
language *helpers.Language
lang string
// The media types this page will be rendered to.
// TODO(bep) probably wrap this to add additional information like template evaluation?
mediaTypes media.Types
}
// pageInit lazy initializes different parts of the page. It is extracted
@@ -1879,6 +1884,12 @@ func kindFromFilename(filename string) string {
return kindUnknown
}
// TODO(bep) output
var (
mediaTypesWithRSS = media.Types{media.HtmlType, media.RSSType}
mediaTypesHTML = media.Types{media.HtmlType}
)
func (p *Page) setValuesForKind(s *Site) {
if p.Kind == kindUnknown {
// This is either a taxonomy list, taxonomy term or a section