Thank you pages from dynamic urls

Hey,

So I have a downloadable list of contents, they each have a separate page so they are using following setup.

content folder
—downloads.md
—thank-you.md
—downloads folder
---------alpha.md
---------beta.md
---------capa.md
---------delta.md

Then in layouts I have the following
downloads folder
—landing.html
—specific.html
—thank-you.html

When I am on the site at downloads/alpha/
The user can request to download the file through a form and upon that submission I wish to go to
downloads/alpha/thank-you

My question is how do I set up the thank-you page. I can’t figure out how to make it dynamic as I just get a 404 page. I can’t set up a url in the thank-you.md for it as I do not know what segment 2 is since it would be dynamic.

Cheers

You can create a index.md inside of a content folder. Example:

content/
content/downloads/index.md
content/downloads/alpha/index.md
content/downloads/alpha/thank-you.md

See what you can do with that.

Hey,

That did the trick, only downside of it was my landing page that originally showed just the alpha, beta pages started listing the thank you pages also since I used.

{{ range ( where .Site.Pages “Section” “downloads” ) }}

The fix for this, I just created an extra field in the specific mds and not the thank you mds called download. So in alpha it would state download = true, allowing me to do the following

{{ range ( where .Site.Pages ".Params.download" "true") }}

Content file structure was as you suggested. Is there a way to filter by md file name? That was my first idea but didn’t find any posts or docs that covered this.

We need to document this, but the page has a File object hanging off of it that can give you some additional information about the source file for the page.

{{ .File.LogicalName }} yields "foo.md"

File is of the type source.File. Documentation about that type is available at https://godoc.org/github.com/spf13/hugo/source.

A pull request is on the way: