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)返回當前格式的媒體類型。