page_marshaljson.autogen.go (6827B)
1 // Copyright 2019 The Hugo Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 // This file is autogenerated. 15 16 package page 17 18 import ( 19 "encoding/json" 20 "github.com/bep/gitmap" 21 "github.com/gohugoio/hugo/common/maps" 22 "github.com/gohugoio/hugo/config" 23 "github.com/gohugoio/hugo/hugofs/files" 24 "github.com/gohugoio/hugo/identity" 25 "github.com/gohugoio/hugo/langs" 26 "github.com/gohugoio/hugo/media" 27 "github.com/gohugoio/hugo/navigation" 28 "github.com/gohugoio/hugo/source" 29 "html/template" 30 "time" 31 ) 32 33 func MarshalPageToJSON(p Page) ([]byte, error) { 34 content, err := p.Content() 35 if err != nil { 36 return nil, err 37 } 38 plain := p.Plain() 39 plainWords := p.PlainWords() 40 summary := p.Summary() 41 truncated := p.Truncated() 42 fuzzyWordCount := p.FuzzyWordCount() 43 wordCount := p.WordCount() 44 readingTime := p.ReadingTime() 45 length := p.Len() 46 tableOfContents := p.TableOfContents() 47 rawContent := p.RawContent() 48 resourceType := p.ResourceType() 49 mediaType := p.MediaType() 50 permalink := p.Permalink() 51 relPermalink := p.RelPermalink() 52 name := p.Name() 53 title := p.Title() 54 params := p.Params() 55 data := p.Data() 56 date := p.Date() 57 lastmod := p.Lastmod() 58 publishDate := p.PublishDate() 59 expiryDate := p.ExpiryDate() 60 aliases := p.Aliases() 61 bundleType := p.BundleType() 62 description := p.Description() 63 draft := p.Draft() 64 isHome := p.IsHome() 65 keywords := p.Keywords() 66 kind := p.Kind() 67 layout := p.Layout() 68 linkTitle := p.LinkTitle() 69 isNode := p.IsNode() 70 isPage := p.IsPage() 71 path := p.Path() 72 pathc := p.Pathc() 73 slug := p.Slug() 74 lang := p.Lang() 75 isSection := p.IsSection() 76 section := p.Section() 77 sectionsEntries := p.SectionsEntries() 78 sectionsPath := p.SectionsPath() 79 sitemap := p.Sitemap() 80 typ := p.Type() 81 weight := p.Weight() 82 language := p.Language() 83 file := p.File() 84 gitInfo := p.GitInfo() 85 outputFormats := p.OutputFormats() 86 alternativeOutputFormats := p.AlternativeOutputFormats() 87 menus := p.Menus() 88 translationKey := p.TranslationKey() 89 isTranslated := p.IsTranslated() 90 allTranslations := p.AllTranslations() 91 translations := p.Translations() 92 getIdentity := p.GetIdentity() 93 94 s := struct { 95 Content any 96 Plain string 97 PlainWords []string 98 Summary template.HTML 99 Truncated bool 100 FuzzyWordCount int 101 WordCount int 102 ReadingTime int 103 Len int 104 TableOfContents template.HTML 105 RawContent string 106 ResourceType string 107 MediaType media.Type 108 Permalink string 109 RelPermalink string 110 Name string 111 Title string 112 Params maps.Params 113 Data any 114 Date time.Time 115 Lastmod time.Time 116 PublishDate time.Time 117 ExpiryDate time.Time 118 Aliases []string 119 BundleType files.ContentClass 120 Description string 121 Draft bool 122 IsHome bool 123 Keywords []string 124 Kind string 125 Layout string 126 LinkTitle string 127 IsNode bool 128 IsPage bool 129 Path string 130 Pathc string 131 Slug string 132 Lang string 133 IsSection bool 134 Section string 135 SectionsEntries []string 136 SectionsPath string 137 Sitemap config.Sitemap 138 Type string 139 Weight int 140 Language *langs.Language 141 File source.File 142 GitInfo *gitmap.GitInfo 143 OutputFormats OutputFormats 144 AlternativeOutputFormats OutputFormats 145 Menus navigation.PageMenus 146 TranslationKey string 147 IsTranslated bool 148 AllTranslations Pages 149 Translations Pages 150 GetIdentity identity.Identity 151 }{ 152 Content: content, 153 Plain: plain, 154 PlainWords: plainWords, 155 Summary: summary, 156 Truncated: truncated, 157 FuzzyWordCount: fuzzyWordCount, 158 WordCount: wordCount, 159 ReadingTime: readingTime, 160 Len: length, 161 TableOfContents: tableOfContents, 162 RawContent: rawContent, 163 ResourceType: resourceType, 164 MediaType: mediaType, 165 Permalink: permalink, 166 RelPermalink: relPermalink, 167 Name: name, 168 Title: title, 169 Params: params, 170 Data: data, 171 Date: date, 172 Lastmod: lastmod, 173 PublishDate: publishDate, 174 ExpiryDate: expiryDate, 175 Aliases: aliases, 176 BundleType: bundleType, 177 Description: description, 178 Draft: draft, 179 IsHome: isHome, 180 Keywords: keywords, 181 Kind: kind, 182 Layout: layout, 183 LinkTitle: linkTitle, 184 IsNode: isNode, 185 IsPage: isPage, 186 Path: path, 187 Pathc: pathc, 188 Slug: slug, 189 Lang: lang, 190 IsSection: isSection, 191 Section: section, 192 SectionsEntries: sectionsEntries, 193 SectionsPath: sectionsPath, 194 Sitemap: sitemap, 195 Type: typ, 196 Weight: weight, 197 Language: language, 198 File: file, 199 GitInfo: gitInfo, 200 OutputFormats: outputFormats, 201 AlternativeOutputFormats: alternativeOutputFormats, 202 Menus: menus, 203 TranslationKey: translationKey, 204 IsTranslated: isTranslated, 205 AllTranslations: allTranslations, 206 Translations: translations, 207 GetIdentity: getIdentity, 208 } 209 210 return json.Marshal(&s) 211 }