mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
hugolib, media: Make the MediaType available to the templates
This commit is contained in:
parent
c7dbee2321
commit
4aaed87dd9
3 changed files with 23 additions and 14 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue