HUGO
Menu
GitHub 87548 stars Mastodon

MediaType

返回给定输出格式的媒体类型。

Syntax

OUTPUTFORMAT.MediaType

Returns

media.Type

要使用此方法,您必须首先使用 GetCanonical 方法从页面的 OutputFormats 集合中选择特定的 输出格式

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

方法

MainType

string)返回输出格式媒体类型的主类型。

SubType

string)返回当前格式媒体类型的子类型。

Type

string)返回当前格式的媒体类型。


Last updated: January 1, 0001
Improve this page