How do I define the parent page alias in the URL pattern field

Erick Valdivieso asked on April 24, 2019 17:59

Hello,

I am in the process of creating a page type for a thank you page, this page only gets visited after a form submission, but I have forms located on different pages and their URLs are different. Here are will give 4 examples:

  • Example #1:
    • Form located on this pages: /resources/datasheets/[datasheet name]
    • Their thank you page would be as fallow: /resources/datasheets/[datasheet name]/thank-you
    • URL parrent: /resources/datasheets/{%NodeGUID%}/{%NodeAlias%}
  • Example #2:
    • Form located on this pages:/resources/application-notes/[application note name]
    • Their thank you page would be as fallow: /resources/application-notes/[application note name]/thank-you
    • URL parrent: /resources/application-notes/{%NodeGUID%}/{%NodeAlias%}
  • Example #3:
    • Form located on this page: /contact-us
    • Their thank you page would be as fallow: /contact-us/thank-you
    • URL pattern: /contact-us
  • Example #4:
    • Form located on this page: /application-evaluation
    • Their thank you page would be as fallow: /application-evaluation/thank-you
    • URL pattern: /application-evaluation

I was envision that I could create 1 page type for the thank you page and properly define the URL patter.

Can you please provide suggestions, examples. Thank You.

Recent Answers


Dmitry Bastron answered on April 24, 2019 19:04 (last edited on December 10, 2019 02:31)

Hi Erick,

You can use this macro, worked for me:

/{% Parent.NodeAlias |(identity)GlobalAdministrator%}

And in the MyCustomeTransformation method you can implement any logic you like. But do not forget that your custom macro assembly (or project) should be included in both CMS and MVC solutions.

2 votesVote for this answer Mark as a Correct answer

Erick Valdivieso answered on April 24, 2019 22:24

Nice, thanks for the quick response. I am going to look into this and see how it goes and keep you posted if I have more questions.

0 votesVote for this answer Mark as a Correct answer

Erick Valdivieso answered on April 25, 2019 16:00

Hi Dmitry Bastron, how would the rout in the RouteConfig.cs file for this thank you page look?

Can you provide a code snippet if possible.

Thanks

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on April 25, 2019 17:59

Hi Eric,

You can refer to this Stackoverflow thread, hope it will help

0 votesVote for this answer Mark as a Correct answer

Erick Valdivieso answered on April 26, 2019 23:20

Thanks, I run into a couple of issues. I believe it had to do on how the controller was setup, but because I am with time constraint, I went ahead and just had all thank you pages render with the same URL structure:

As reference here is how my route looks:

routes.MapRoute(
                name: "Thank You",
                url: "form/{guid}/{pageAlias}",
                defaults: new { controller = "ThankYou", action = "Index" }
            );

Then here is how the URL pattern looks for the page type:

/form/{%NodeGUID%}/{%NodeAlias%}

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.