# HubL If Statements

**URL:** <https://community.hubspot.com/t/hubl-if-statements/9048>\
**Category:** CMS Development\
**Created:** [June 4, 2018, 2:59pm UTC](https://community.hubspot.com/t/hubl-if-statements/9048 "2018-06-04T14:59:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cinanoglu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cinanoglu/32/2401_2.png) [@cinanoglu](https://community.hubspot.com/u/cinanoglu)\
**Post date:** [June 4, 2018, 2:59pm UTC](https://community.hubspot.com/t/hubl-if-statements/9048/1 "2018-06-04T14:59:23Z")

</div>

Hello everyone,

Is there a HubL if statement that would display content based on the URL. What I’m trying to accomplish is having a dynamic content section in the sidebar. I’d like to know if there is another way to do this as well.

Thank you for the help!

Cenker

---

<div class="post-metadata">

**Author:** ![MFrankJohnson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mfrankjohnson/32/22490_2.png) [@MFrankJohnson](https://community.hubspot.com/u/MFrankJohnson)\
**Post date:** [June 4, 2018, 3:50pm UTC](https://community.hubspot.com/t/hubl-if-statements/9048/2 "2018-06-04T15:50:17Z")

</div>

![2000px-Ok_sign_font_awesome.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/d/3d0e842550421e09408c7c45efd7aac97cda0d46.png)  
Does my post help answer your question?

Help the Community by **marking it as SOLVED**

**Q** : Is there a HubL if statement that would display content based on the URL?

**Short A** : see **[Solved: Display information based on url factors?](https://community.hubspot.com/t5/Content-Design-Questions/Display-information-based-on-url-factors/m-p/936/highlight/true#M56)**

[  
  ![share-on-Linkedin-Button-75x19.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/0/d/0d2a6188089ff0489f45282d93ae8b10e3612611.png)  
 ](https://www.linkedin.com/in/mfjlabs)

* * *

[  
  ![hubspot-forum-signature-badge-v01.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/a/9abba43db594bbc5e8c2a1e00d81cf8fb213c6a6.png)  
 ](https://mfrankjohnson.com/?utm_source=hs-forum)

[www.MFrankJohnson.com](https://www.mfrankjohnson.com/?utm_source=hs-forum)

_ **Please include @MFrankJohnson in your message if you’d like me to reply.** _

---

<div class="post-metadata">

**Author:** ![cinanoglu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cinanoglu/32/2401_2.png) [@cinanoglu](https://community.hubspot.com/u/cinanoglu)\
**Post date:** [June 4, 2018, 4:48pm UTC](https://community.hubspot.com/t/hubl-if-statements/9048/3 "2018-06-04T16:48:33Z")

</div>

Hello @MFrankJohnson,

Thanks for sharing the thread.

I’m still confused about how to use this statement;

{% if request.query\_dict.utm\_campaign == “ **something** ” %}

Let’s say I have a campaign called “Smart Content”, what should I change “something” with?

Thank you!

---

<div class="post-metadata">

**Author:** ![MFrankJohnson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mfrankjohnson/32/22490_2.png) [@MFrankJohnson](https://community.hubspot.com/u/MFrankJohnson)\
**Post date:** [June 4, 2018, 6:23pm UTC](https://community.hubspot.com/t/hubl-if-statements/9048/4 "2018-06-04T18:23:05Z")

</div>

Hey @cinanoglu,

Here are a couple more resources that should clear it up for you …

- see **[Personalization based on query string data](https://integrate.hubspot.com/t/personalization-based-on-query-string-data/8864)**

- see **[HTTP request variables](https://designers.hubspot.com/docs/hubl/hubl-supported-variables#http-request-variables)**

You’ll have more success on the HubSpot Developers Forum for Hubl questions like these.

Hope that helps.

Best,

Frank

---

<div class="post-metadata">

**Author:** ![cinanoglu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cinanoglu/32/2401_2.png) [@cinanoglu](https://community.hubspot.com/u/cinanoglu)\
**Post date:** [June 4, 2018, 7:10pm UTC](https://community.hubspot.com/t/hubl-if-statements/9048/5 "2018-06-04T19:10:00Z")

</div>

Hello @MFrankJohnson,

Thank you so much! I modified the code with;

{% if request.path == “/xxx” %} and it works just fine.

Have a great rest of your day!

---

<div class="post-metadata">

**Author:** ![MFrankJohnson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mfrankjohnson/32/22490_2.png) [@MFrankJohnson](https://community.hubspot.com/u/MFrankJohnson)\
**Post date:** [June 29, 2018, 9:45pm UTC](https://community.hubspot.com/t/hubl-if-statements/9048/6 "2018-06-29T21:45:46Z")

</div>

Excellent @cinanoglu. Gotta say, that’s a lot easier than anything I’ve ever done in WordPress or .js! haha

Thanks for circling back with your success story. It helps others see value in the HubSpot Community.

Best,

Frank
