hugolib, media: Make the MediaType available to the templates

This commit is contained in:
Bjørn Erik Pedersen 2017-03-22 11:03:42 +01:00
parent c7dbee2321
commit 4aaed87dd9
3 changed files with 23 additions and 14 deletions

View file

@ -19,6 +19,8 @@ import (
"strings"
"sync"
"github.com/spf13/hugo/media"
"github.com/spf13/hugo/output"
)
@ -133,6 +135,7 @@ type OutputFormat struct {
// It may be tempting to export this, but let us hold on to that horse for a while.
f output.Format
p *Page
}
@ -141,6 +144,11 @@ func (o OutputFormat) Name() string {
return o.f.Name
}
// MediaType returns this OutputFormat's MediaType (MIME type).
func (o OutputFormat) MediaType() media.Type {
return o.f.MediaType
}
// TODO(bep) outputs consider just save this wrapper on Page.
// OutputFormats gives the output formats for this Page.
func (p *Page) OutputFormats() OutputFormats {