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