How do I do something (anything) with the URL?


#1

Hey guys!

I’d like to have a section with multiple entries on the main page, and if I click one, I get to e.g. http://example.org/something-awesome (basically like a basic blog). Then, I’d like to only display the entry which has a field (let’s call it slug) set to something-awesome, but I have no idea how to compare something with a part of the URL in a Vapid template.

What would be the way to realize that with Vapid? The only way I can think of right now would be to render all entries and then filter it using client-side JavaScript, but that’s not exactly a good solution I guess.
Maybe I can access the client request object from a Vapid template directly somehow?
Or use variables in filenames, so I can create a file/folder named something like /blog/{{mysection.slug}}.html that matches every value of slug (like /blog/something-awesome.html)?


#2

@moqmar Take a look at the “Link to Repeating Content” section of the docs. It sounds like what you’re looking for.

https://docs.vapid.com/learn-more#sections