<!---
Add the issue number that is discussed and fixed by this PR (In the form
`Closes #123`). If this PR doesn't fix an issue, remove the line below.
This will
also lead to us not treating this PR as an important one. It might be
closed
without a review.
If there is no issue associated with this PR and you are not a
maintainer of
this repository, your PR might be closed without a review.
-->
Closes#794
You can no longer set `recent_posts_number = 0` because in current hugo
versions `{{ $n_posts := $.Param "recent_posts_number" | default 3 }}`
will default to three if recent_posts_number is 0. This used to work a
couple of versions back, I am assuming this is not a regression but
rather wanted behavior in hugo -- so I introduce a new parameter
(boolean) `show_recent_posts` to enable(default) or disable recent posts
on index.
<!---
Explain what this PR does and what existing problem it solves. If this
PR is a
work in progress, please prefix the title with [WIP].
-->
<!--
Make sure that the code is readable and well-documented. If you have
added new
functionality, please add the necessary documentation.
If testing of the new functionality is possible, please add tests.
-->
A bare bones setup of two pages and two posts gets broken because of a
template change missed in #665
Fatal error message in readable form:
```
ERROR render:
failed to render pages:
render of "home" failed: "/themes/ananke/layouts/index.html:48:23":
execute of template failed:
template:
index.html:48:23:
executing "main" at <.Site.GetPage>: can't evaluate field Site in type string
```
Steps to reproduce:
```shell
hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml
echo -e "+++\ntitle='Home'\n+++\n\nMain page" > content/_index.md
echo Foo. > content/page1.md
echo Bar > content/page2.md
mkdir -p content/post
echo "First post." > content/post/post1.md
echo "Second post." > content/post/post2.md
hugo server
Watching for changes in .../quickstart/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in .../quickstart/hugo.toml, ...quickstart/themes/ananke/config.yaml
Start building sites …
hugo v0.125.3-474c4c02212cf97712c6fbf4159c68822ea6e078+extended darwin/amd64 BuildDate=2024-04-22T17:18:35Z VendorInfo=brew
Built in 67 ms
Error: error building site: render: failed to render pages: render of "home" failed: ".../quickstart/themes/ananke/layouts/index.html:48:23": execute of template failed: template: index.html:48:23: executing "main" at <.Site.GetPage>: can't evaluate field Site in type string
```
Using the `{{ .URL }}` token results in a warning:
WARN 2019/10/13 15:12:12 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.
Steps to reproduce
==================
Follow along with the Quick Start guide at
https://gohugo.io/getting-started/quick-start/
Running `hugo server -D` emits a warning that `.URL` is deprecated.