Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get corrected URL in search results #9

Open
Tessachu opened this issue Jul 28, 2015 · 1 comment
Open

Get corrected URL in search results #9

Tessachu opened this issue Jul 28, 2015 · 1 comment

Comments

@Tessachu
Copy link

It's not necessarily an issue, but a feature request. I'll use my example to explain what I'm asking for.

I created a dynamic FAQ page, so that the parent node has a template that loops through and displays all of the children nodes (which holds a single question and answer per child) on the parent's URL, /faq. None of the children nodes use a template because I don't anticipate using those URLs that get generated.

I want the FAQ page to be searchable, but as it works right now, the results that get pulled from searching through the FAQ's questions and answers links to the default URLs of those children, which results in 404 pages when clicked because they simply don't have templates. My goal is for those links to be redirected to a specified URL.

Now these children nodes have the special "umbracoURLAlias" and "umbracoUrlName" properties. The latter which changes the URL relative to its parent, so it's not really any help redirecting to its parent, and it would still result in a 404 because again, this node doesn't have a template. The former only works when the value in the property has been typed into the browser, so it doesn't necessarily apply in this situation, because the /faq URL already exists, it just renders that page instead of the children pages using it as an alias. Essentially, it does nothing for this particular case.

So I was wondering if you could set it up, or if you could teach me how to set it up because I'm not quite that adept at MVC or C# yet, so that when it renders the link for the URL, if it could first check for the "umbracoURLAlias" or other specified property name, and if that's left blank, then use the default URL as usual.

Please and thanks!

@harvzor
Copy link

harvzor commented Sep 27, 2016

TL;DR:

If a node has a rewritten path (using umbracoUrlAlias or umbracoUrlName) then check to see if that path 404s, if it doesn't, display the result.

If a node does not have a rewritten path, then check if it has a template, if it doesn't, display the result.

If the node does not have a rewritten path, does have a template, display the result as normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants