page title via query string macro

John Smith asked on October 20, 2017 23:10

Hello,

I am trying to update the page title via a query string macro {?Name?} but it doesn't seem to work.. I see the page title is "Site Name" - {?Name?}

I tried another such as {%CurrentDocument.Name%} just to see if macros work and it showed the text instead of macro. I'm not sure why it isn't working. Has anyone else run into this issue?

Thanks,

Recent Answers


Brenden Kehren answered on October 20, 2017 23:35 (last edited on December 10, 2019 02:31)

If the querystring parameter does not exist it will render the actual macro so not really idea. Try something like this:

{% if (QueryString.GetValue("name") != "") { QueryString.GetValue("name") } else { DocumentName } |(identity)GlobalAdministrator%}

So if the name parameter has a value then it will render it, if it doesn't it will render the current document name.

0 votesVote for this answer Mark as a Correct answer

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