页面方法
使用这些方法与页面对象。
使用这些方法与页面对象。
PAGE.BundleType ⟼ string返回给定页面的包类型,如果页面不是页面包,则返回空字符串。 Read More »
PAGE.CodeOwners ⟼ []string返回给定页面的代码所有者切片,该切片源自项目目录根目录下的 CODEOWNERS 文件。 Read More »
PAGE.ContentWithoutSummary ⟼ template.HTML返回给定页面的渲染内容,不包括内容摘要。 Read More »
PAGE.ExpiryDate ⟼ time.Time返回给定页面的过期日期。 Read More »
PAGE.GetPage PATH ⟼ page.Page从给定路径返回一个 Page 对象。 Read More »
PAGE.GetTerms TAXONOMY ⟼ page.Pages返回给定分类中,在给定页面上定义的术语页面的集合,其顺序与他们在前置内容中出现的顺序一致。 Read More »
PAGE.GitInfo ⟼ source.GitInfo返回与给定页面的最后一次提交相关的 Git 信息。 Read More »
PAGE.HasMenuCurrent MENU MENUENTRY ⟼ bool报告给定菜单条目下给定菜单中的子菜单条目之一是否与关联的 Page 对象匹配。 Read More »
PAGE.HasShortcode NAME ⟼ bool报告给定页面是否调用了给定的简码。 Read More »
PAGE.InSection SECTION ⟼ bool报告给定页面是否在给定部分中。 Read More »
PAGE1.IsAncestor PAGE2 ⟼ bool报告 PAGE1 是否是 PAGE2 的祖先。 Read More »
PAGE1.IsDescendant PAGE2 ⟼ bool报告PAGE1是否为PAGE2的子级。 Read More »
PAGE.IsHome ⟼ bool报告给定页面是否为主页。 Read More »
PAGE.IsMenuCurrent MENU MENUENTRY ⟼ bool报告给定页面对象是否与给定菜单中给定菜单项关联的页面对象匹配。 Read More »
PAGE.IsNode ⟼ bool报告给定页面是否为节点。 Read More »
PAGE.IsPage ⟼ bool报告给定页面是否为常规页面。 Read More »
PAGE.IsSection ⟼ bool报告给定页面是否为章节页面。 Read More »
PAGE.IsTranslated ⟼ bool报告给定页面是否具有一个或多个翻译。 Read More »
PAGE.Lastmod ⟼ time.Time返回给定页面的上次修改日期。 Read More »
PAGE.Len ⟼ int返回给定页面渲染内容的字节长度。 Read More »
PAGE.LinkTitle ⟼ string返回给定页面的链接标题。 Read More »
PAGE.NextInSection ⟼ page.Page返回指定页面所在章节中的下一个常规页面。 Read More »
PAGE.Store ⟼ maps.Scratch返回给定页面上的持久性“备忘录”以存储和操作数据。 Read More »
PAGE.Plain ⟼ string返回给定页面的渲染内容,移除所有 HTML 标签。 Read More »
PAGE.PlainWords ⟼ []string调用 Plain 方法,将结果拆分为单词切片,并返回该切片。 Read More »
PAGE.PrevInSection ⟼ page.Page返回某个章节中相对于给定页面的上一页常规页面。 Read More »
PAGE.PublishDate ⟼ time.Time返回给定页面的发布日期。 Read More »
PAGE.RegularPages ⟼ page.Pages返回当前章节内常规页面的集合。 Read More »
PAGE.RegularPagesRecursive ⟼ page.Pages返回当前区块内以及所有子区块内的常规页面集合。 Read More »
PAGE.RelPermalink ⟼ string返回给定页面的相对永久链接。 Read More »
PAGE.RelRef OPTIONS ⟼ string返回具有给定路径、语言和输出格式的页面的相对 URL。 Read More »
PAGE.Render NAME ⟼ template.HTML使用给定的页面作为上下文渲染给定的模板。 Read More »
PAGE.RenderShortcodes ⟼ template.HTML渲染给定页面内容中的所有短代码,同时保留周围的标记。 Read More »
PAGE.RenderString [OPTIONS] MARKUP ⟼ template.HTML将标记渲染为HTML。 Read More »
PAGE.Slug ⟼ string返回页面在 front matter 中定义的 URL slug。 Read More »
PAGE.Truncated ⟼ bool报告内容长度是否超过摘要长度。 Read More »
PAGE.Prev ⟼ page.Page返回站点常规页面集合中相对于当前页面的上一页。 Read More »
PAGE.Next ⟼ page.Page返回站点常规页面集合中相对于当前页面的下一页。 Read More »
PAGE.Scratch ⟼ maps.Scratch返回给定页面上的“临时存储区”以存储和操作数据。 Read More »
PAGE.Keywords ⟼ []string返回在 front matter 中定义的关键词切片。 Read More »
PAGE.Content ⟼ template.HTML返回给定页面的渲染内容。 Read More »
PAGE.Paginate COLLECTION [N] ⟼ page.Pager对页面集合进行分页。 Read More »
PAGE.Paginator ⟼ page.Pager对在上下文中接收到的常规页面集合进行分页。 Read More »
PAGE.Aliases ⟼ []string返回在 front matter 中定义的 URL 别名。 Read More »
PAGE.RawContent ⟼ string返回给定页面的原始内容。 Read More »
PAGE.Param KEY ⟼ any返回具有给定键的页面参数,如果存在则回退到站点参数。 Read More »
PAGE.Params ⟼ maps.Params返回给定页面前置内容中定义的自定义参数映射。 Read More »
PAGE.AlternativeOutputFormats ⟼ page.OutputFormats返回一个
OutputFormat
对象的切片,不包括当前输出格式,每个对象都代表为给定页面启用的输出格式之一。
Read More »
PAGE.Translations ⟼ page.Pages返回给定页面的所有翻译,不包括当前语言。 Read More »
PAGE.WordCount ⟼ int返回给定页面内容中的字数。 Read More »
PAGE.Layout ⟼ string返回在 front matter 中定义的给定页面的布局。 Read More »
PAGE.Ref OPTIONS ⟼ string返回具有给定路径、语言和输出格式的页面的绝对 URL。 Read More »
PAGE.CurrentSection ⟼ page.Page返回给定页面所在的章节的页面对象。 Read More »
PAGE.AllTranslations ⟼ page.Pages返回给定页面的所有翻译,包括当前语言。 Read More »
PAGE.Summary ⟼ template.HTML返回给定页面的摘要。 Read More »
PAGE.Data ⟼ page.Data为每种页面类型返回唯一的数据对象。 Read More »
PAGE.File ⟼ hugolib.fileInfo对于由文件支持的页面,返回给定页面的文件信息。 Read More »
PAGE.Date ⟼ time.Time返回给定页面的日期。 Read More »
PAGE.Weight ⟼ int返回页面在 front matter 中定义的权重。 Read More »
PAGE.Title ⟼ string返回给定页面的标题。 Read More »
PAGE.HeadingsFiltered ⟼ tableofcontents.Headings返回与给定页面相关的每个页面的标题切片。 Read More »
PAGE.FuzzyWordCount ⟼ int返回给定页面内容中的字数,四舍五入到最接近的 100 的倍数。 Read More »
PAGE.Permalink ⟼ string返回给定页面的永久链接。 Read More »
PAGE.Parent ⟼ page.Page返回给定页面的父级部分的 Page 对象。 Read More »
PAGE.Fragments ⟼ tableofcontents.Fragments返回给定页面中片段的数据结构。 Read More »
PAGE.TableOfContents ⟼ template.HTML返回给定页面的目录。 Read More »
PAGE1.Eq PAGE2 ⟼ bool报告两个页面对象是否相等。 Read More »
PAGE.Ancestors ⟼ page.Pages返回一个页面对象集合,每个对象代表给定页面的一个祖先章节。 Read More »
PAGE.Kind ⟼ string返回给定页面的种类。 Read More »
PAGE.Site ⟼ page.siteWrapper返回站点对象。 Read More »
PAGE.Sites ⟼ page.Sites返回所有站点对象的集合,每个语言一个,按语言权重排序。 Read More »
PAGE.Sitemap ⟼ config.SitemapConfig返回给定页面在 front matter 中定义的站点地图设置,如果未定义则回退到站点配置中定义的站点地图设置。 Read More »
PAGE.FirstSection ⟼ page.Page返回给定页面所属顶级部分的 Page 对象。 Read More »
PAGE.Type ⟼ string返回给定页面的内容类型。 Read More »
PAGE.TranslationKey ⟼ string返回给定页面的翻译密钥。 Read More »
PAGE.Sections ⟼ page.Pages返回一个节区页面集合,每个页面对应给定页面的每个直接子节区。 Read More »
PAGE.Draft ⟼ bool报告给定页面是否为前置内容中定义的草稿。 Read More »
PAGE.Language ⟼ langs.Language返回给定页面的语言对象。 Read More »
PAGE.Resources ⟼ resource.Resources返回页面资源的集合。 Read More »
PAGE.Path ⟼ string返回给定页面的逻辑路径。 Read More »
PAGE.OutputFormats ⟼ []OutputFormat返回一个 OutputFormat 对象的切片,每个对象代表为给定页面启用的输出格式之一。 Read More »
PAGE.Section ⟼ string返回给定页面所在的顶级部分的名称。 Read More »
PAGE.ReadingTime ⟼ int返回给定页面的预计阅读时间(以分钟为单位)。 Read More »
PAGE.Page ⟼ page.Page返回给定页面的 Page 对象。 Read More »
PAGE.Pages ⟼ page.Pages返回当前章节内常规页面的集合,以及直接子章节的章节页面。 Read More »
PAGE.Description ⟼ string返回页面在 front matter 中定义的描述。 Read More »