MediaType
返回给定输出格式的媒体类型。
Syntax
OUTPUTFORMAT.MediaType
Returns
media.Type
要使用此方法,您必须首先使用 Get 或 Canonical 方法从页面的 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)返回当前格式的媒体类型。