HUGO
Menu
GitHub 86531 stars Mastodon

MediaType

Returns the media type of the given output format.

Syntax

OUTPUTFORMAT.MediaType

Returns

media.Type

To use this method you must first select a specific output format from a page’s OutputFormats collection using the Get or Canonical methods.

{{ with .Site.Home.OutputFormats.Get "rss" }}
  {{ with .MediaType }}
    {{ .Type }}       → application/rss+xml
    {{ .MainType }}   → application
    {{ .SubType }}    → rss
  {{ end }}
{{ end }}

Methods

MainType

(string) Returns the main type of the output format’s media type.

SubType

(string) Returns the subtype of the current format’s media type.

Type

(string) Returns the the current format’s media type.