Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Re-direction using site.yaml

Started by RMC 7 years ago · 1 replies · 349 views
7 years ago

Hi, I'm new to Grav, always looking for new tech...
I have installed and tested, it looks great, is fast, I like that, it could be great if we can use blade engine.
Any way, I have installed and have some basic pages, home, blog, services, gallery, contact and a basic survey, with just: name, email, phone, comments, and rating radio btn's...

To get to this page /survey with a get request I'm using other pages...
/other-page has only name and email when user clicks [Continue] he/she is redirected to the page /survey?name=Llilu+lili&[email protected]
using javaScript I capture this params and put them in their correct inputs, after that I clear the URL and the user can continue answer my survey...
Up to this point everything works great! but the link to this /survey it visible in the menu I could hide it with CSS but want to know if is possible to do...
Question: Using site.yaml how can I redirect a user from /survey if the user got there without the parameters required? which is this case are ?name&email ...

last edited 02/22/19 by RMC
7 years ago

To hide the page survey in the menu set the frontmatter variable visible to false. You can do that in the page frontmatter (often called the page header) like this:

TXT
visible: false

Or you can set it via the Admin panel when editing the page there.

You can create a conditional redirect through advanced routing and using a regular expression, see Redirects and the section above it about Regex-Based Aliases.

last edited 02/22/19 by Ron Wardenier

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
3 101 7 hours ago
Support · by Anna, 3 days ago
2 98 1 day ago
Support · by Justin Young, 1 day ago
1 66 1 day ago
Support · by Duc , 1 week ago
2 101 6 days ago
Support · by Colin Hume, 1 week ago
2 94 6 days ago