Condition to display a text depends on the URL in Web Parts

Raymond Rofuli asked on July 2, 2018 07:36

Hi Everyone,

I wondering if someone can help me with this.

Currently I had a Web part which be displayed inside the "<head>" tag then I want to make a condition inside that Web part to display a certain text depends on the URL.

Sample: {% if (url = "/browse/?tagname=pets&groupid=1") return "text1"; if (url = "/broswse/?tagname=name&groupid=2") return "text2"; #%}

Is this possible?

Recent Answers

David te Kloese answered on July 2, 2018 10:52


What would be the logic? And how are you going to maintain it?

You could get the current Page path properties using something like:

{% CurrentPath %}
{% CurrentDocument.AbsoluteURL  %}

And the Query string params like:

{% QueryString.GetValue("paramName") %} or {%paramName%}

0 votesVote for this answer Mark as a Correct answer

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