Skip to content

Add dump template func for debugging #3957

Closed
@bep

Description

@bep

See https://github.com/sanity-io/litter

The output is great (as below from a random test), but may be "too much" even for the advanced user:

&hugolib.Page{ // p0
  pageInit: &hugolib.pageInit{},
  Kind: "home",
  Pages: nil,
  Params: map[string]interface {}{
    "draft": false,
    "expirydate": time.Time{},
    "iscjklanguage": false,
    "lastmod": time.Time{},
    "outputs": output.Formats{ // p1210
      output.Format{
        Name: "JSON",
        MediaType: media.Type{
          MainType: "application",
          SubType: "json",
          Suffix: "json",
          Delimiter: ".",
        },
        Path: "",
        BaseName: "index",
        Rel: "alternate",
        Protocol: "",
        IsPlainText: true,
        IsHTML: false,
        NoUgly: false,
        NotAlternative: false,
      },
    },
    "publishdate": time.Time{},
    "title": "JSON Home",
  },
  Content: "\n\n<h1 id=\"doc\">Doc</h1>\n\nShortJSON\n\nOtherShort: <h1>Hi!</h1>\n",
  Summary: " Doc ShortJSON OtherShort: Hi! ",
  TableOfContents: "<nav id=\"TableOfContents\">\n<ul>\n<li><a href=\"#doc\">Doc</a></li>\n</ul>\n</nav>",
  Aliases: nil,
  Images: nil,
  Videos: nil,
  Truncated: false,
  Draft: false,
  Status: "",
  PublishDate: time.Time{},
  ExpiryDate: time.Time{},
  PageMeta: hugolib.PageMeta{
    Weight: 0,
  },
  Markup: "markdown",
  Layout: "",
  Source: hugolib.Source{
    Frontmatter: nil,
    Content: nil,
    File: source.File{
      Contents: nil,
    },
  },
  Position: hugolib.Position{
    Prev: nil,
    Next: nil,
    PrevInSection: nil,
    NextInSection: nil,
  },
  GitInfo: nil,
  Site: &hugolib.SiteInfo{
    Taxonomies: hugolib.TaxonomyList{ // p34
      "categories": hugolib.Taxonomy{
      },
      "en": hugolib.Taxonomy{
      },
      "tags": hugolib.Taxonomy{
      },
    },
    Authors: hugolib.AuthorList{
    },
    Social: hugolib.SiteSocial{ // p1204
    },
    PageCollections: &hugolib.PageCollections{ // p35
      Pages: hugolib.Pages{
        p0,
      },
      AllPages: hugolib.Pages{ // p687
        p0,
        &hugolib.Page{ // p1
          pageInit: &hugolib.pageInit{},
          Kind: "home",
          Pages: nil,
          Params: map[string]interface {}{
            "draft": false,
            "expirydate": time.Time{},
            "iscjklanguage": false,
            "lastmod": time.Time{},
            "outputs": output.Formats{ // p1202
              output.Format{
                Name: "JSON",
                MediaType: media.Type{
                  MainType: "application",
                  SubType: "json",
                  Suffix: "json",
                  Delimiter: ".",
                },
                Path: "",
                BaseName: "index",
                Rel: "alternate",
                Protocol: "",
                IsPlainText: true,
                IsHTML: false,
                NoUgly: false,
                NotAlternative: false,
              },
            },
            "publishdate": time.Time{},
            "title": "JSON Nynorsk Heim",
          },
          Content: "\n\n<h1 id=\"doc\">Doc</h1>\n\nShortJSON\n\nOtherShort: <h1>Hi!</h1>\n",
          Summary: " Doc ShortJSON OtherShort: Hi! ",
          TableOfContents: "<nav id=\"TableOfContents\">\n<ul>\n<li><a href=\"#doc\">Doc</a></li>\n</ul>\n</nav>",
          Aliases: nil,
          Images: nil,
          Videos: nil,
          Truncated: false,
          Draft: false,
          Status: "",
          PublishDate: time.Time{},
          ExpiryDate: time.Time{},
          PageMeta: hugolib.PageMeta{
            Weight: 0,
          },
          Markup: "markdown",
          Layout: "",
          Source: hugolib.Source{
            Frontmatter: nil,
            Content: nil,
            File: source.File{
              Contents: nil,
            },
          },
          Position: hugolib.Position{
            Prev: nil,
            Next: nil,
            PrevInSection: nil,
            NextInSection: nil,
          },
          GitInfo: nil,
          Site: &hugolib.SiteInfo{
            Taxonomies: hugolib.TaxonomyList{ // p688
              "categories": hugolib.Taxonomy{
              },
              "en": hugolib.Taxonomy{
              },
              "tags": hugolib.Taxonomy{
              },
            },
            Authors: hugolib.AuthorList{
            },
            Social: hugolib.SiteSocial{ // p1196
            },
            PageCollections: &hugolib.PageCollections{ // p689
              Pages: hugolib.Pages{
                p1,
              },
              AllPages: p687,
              RegularPages: nil,
              AllRegularPages: nil,
            },
            Files: &nil, // p1197
            Menus: &hugolib.Menus{ // p691
            },
            Hugo: nil,
            Title: "Tittel på Nynorsk",
            RSSLink: "http://example.com/blog/index.xml",
            Author: map[string]interface {}{ // p1199
            },
            LanguageCode: "",
            DisqusShortname: "",
            GoogleAnalytics: "",
            Copyright: "",
            LastChange: time.Time{},
            Permalinks: hugolib.PermalinkOverrides{ // p1200
            },
            Params: map[string]interface {}{ // p690
              "languagename": "Nynorsk",
              "title": "Tittel på Nynorsk",
              "weight": 2,
            },
            BuildDrafts: false,
            Data: &map[string]interface {}{ // p43
            },
            Language: &helpers.Language{ // p40
              Lang: "nn",
              LanguageName: "Nynorsk",
              Title: "Tittel på Nynorsk",
              Weight: 2,
              Cfg: &viper.Viper{}, // p39
            },
            LanguagePrefix: "/nn",
            Languages: helpers.Languages{ // p41
              &helpers.Language{ // p38
                Lang: "en",
                LanguageName: "English",
                Title: "Title in English",
                Weight: 1,
                Cfg: p39,
              },
              p40,
            },
          },
          Title: "JSON Nynorsk Heim",
          Description: "",
          Keywords: []string{} // p3
,
          Data: map[string]interface {}{
            "Pages": nil,
          },
          Date: time.Time{},
          Lastmod: time.Time{},
          Sitemap: hugolib.Sitemap{
            ChangeFreq: "",
            Priority: -1,
            Filename: "",
          },
          URLPath: hugolib.URLPath{
            URL: "/",
            Permalink: "",
            Slug: "",
            Section: "",
          },
        },
      },
      RegularPages: nil,
      AllRegularPages: nil,
    },
    Files: &nil, // p1205
    Menus: &hugolib.Menus{ // p42
    },
    Hugo: nil,
    Title: "Title in English",
    RSSLink: "http://example.com/blog/index.xml",
    Author: map[string]interface {}{ // p1207
    },
    LanguageCode: "",
    DisqusShortname: "",
    GoogleAnalytics: "",
    Copyright: "",
    LastChange: time.Time{},
    Permalinks: hugolib.PermalinkOverrides{ // p1208
    },
    Params: map[string]interface {}{ // p36
      "languagename": "English",
      "title": "Title in English",
      "weight": 1,
    },
    BuildDrafts: false,
    Data: &p43, // p1209
    Language: p38,
    LanguagePrefix: "",
    Languages: p41,
  },
  Title: "JSON Home",
  Description: "",
  Keywords: p3,
  Data: map[string]interface {}{
    "Pages": nil,
  },
  Date: time.Time{},
  Lastmod: time.Time{},
  Sitemap: hugolib.Sitemap{
    ChangeFreq: "",
    Priority: -1,
    Filename: "",
  },
  URLPath: hugolib.URLPath{
    URL: "/",
    Permalink: "",
    Slug: "",
    Section: "",
  },
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions