mattstratton / castanet

A podcast-oriented theme for Hugo
MIT License
115 stars 61 forks source link

use global hugo function and .url deprecated #206

Closed nonumeros closed 4 years ago

nonumeros commented 5 years ago

with recent hugo 0.55 you'd get Page's .Hugo is deprecated and will be removed in a future release. Use the global hugo function.

which you can fix on meta.html with hugo.Generator but the issue I see is that even with the following https://github.com/gohugoio/hugo/commit/2957795f5276cc9bc8d438da2d7d9b61defea225

your implementation of .URL is not intuitive on files such as grid.html

The reason I'm bringing up .URL is from the autogenerated messages from hugo 0.55 in which a warning comes up letting you know that

WARN Page's .URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url.

the message is from general.go hugo's general.go DistinctWarnLog.Printf("%s's %s is deprecated and will be removed in a future release. %s", object, item, alternative)

and

page_wrappers.autogen.go

helpers.Deprecated("Page", ".URL", "Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url"

also, I don't know what hugo version you generated the site with, but with a simple config file and only the minimum

 baseurl = "http://sample-castanet.netlify.com/mysite/"
 languageCode = "en-us"
 title = "HugoCast"

you'd get executing "partials/header.html" at <sort .Site.Menus.main "Identifier">: error calling sort: sequence must be provided

Of course you could probably say range .Site.Menus.main but you'd still have the <!--page # buttons --> section from grid.html before hugo can generate the site without further errors

in other words, iwth meta.html modified, the warning Page's .Hugo is deprecated and will be removed in a future release. Use the global hugo function. is gone, and assuming that header.html is also modified, everything seems fine from the outside. No warnings. But the fact that starting with future versions, .URL will be removed, while grid.html or list.html implement it, is troublesome.

mattstratton commented 4 years ago

OK, so I did a little digging.

grid.html throws a warning about .URL, but it's not on the Page object, but on the Paginator. The Hugo docs still show URL as a valid property of a Pagination object https://gohugo.io/templates/pagination/

Pagination
Hugo supports pagination for your homepage, section pages, and taxonomies.
nonumeros commented 4 years ago

You're probably correct as long as we're talking here about the same version.

But Matt, before going any further on this issue or any other for that matter, have you tried 0.58.3?

I can't keep up with the curent pace of hugo development, and it's been a while since we dealt with the url deprecation issue that I believe you kindly merged the changes later on from that pull request...

But before going any further - and the following might be an issue on its own right - but if I were to to create a site with anything other than 0.58.3,

I'd get for example, with 0.50 you'd have

 layouts/partials/grid.html:11:1": parse failed: template: partials/grid.html:11: function "site" not defined

which validates your findings

If on the other hand you'd run it with 0.55 you'd get

 ERROR 2019/11/25 00:39:46 CASTANET theme does not support Hugo version 0.55.0. Minimum version required is 0.58.3

Even running ti with say 0.58 you'd have

 WARN 2019/11/25 00:40:44 Module "castanet" is not compatible with this Hugo version; run "hugo mod graph" for more information.

But I don't know at this point whether you might need to specify the only version that seems to be working on the README file or if there's any other outstanding issue that you might need to look into and for which I'm simply unaware of, and which would disallow you to do it [specify the only version that seems not to throw any error.]

mattstratton commented 4 years ago

have you tried 0.58.3

Yes, that is the version that I run my site on, as well as the current test matrix for this theme. It's also the minimum version as listed in theme.toml

I believe you kindly merged the changes later on from that pull request

And I had to just back them out, as the changes to grid.html broke, because Permalink is not a property of the Paginator object :)

So I'm not quite sure what the issue is that you're raising; the minimum version is documented in the theme.toml as advised by the requirements for listing in the Hugo themes gallery. The requirement on that minimum Hugo version was due to me having to make some changes to resolve a breaking issue with .58 and higher; I have to set a minimum version, and in keeping with SemVer, the version of this theme that introduced those changes is a major version update :)

nonumeros commented 4 years ago

And I had to just back them out, as the changes to grid.html broke, because Permalink is not a property of the Paginator object :)

Thank you Matt. My bad for not reading theme.toml where I missed the minimum version part.

the version of this theme that introduced those changes is a major version update :)

Good to know! Thanks

mattstratton commented 4 years ago

I think this is resolved