Hide section of blogger template on page load based on a string present in the url

Viewed 69

How can I hide a section in my blogger template (contempo) on page load based on a string present in the url?

In particular I'd like to hide the aside / sidebar-container based on a url parameter that is present, for example myblog.com/p/mypage.html?sidebar=hide

Note I'm not looking to use CSS such as display:none as that still loads all of the aside content from the template adding to page load time due to unnecessary bulk. I'm looking to exclude it from the template section code based on a string contains (or similar) condition.

For example, I'd love to be able to use something like <b: if cond= to exclude a section from the template, BUT in my case I need something like <b: if cond CONTAINS mystring ( the key difference being the use of CONTAINS instead of = )

I've been looking for an answer to this for months off and on with no replies on how to do it.

Thank you if you can help.

1 Answers

Blogger ignore most of url params, so you can't use ?sidebar=hide.

The only param (I know) that can be a used like that is view, because we can get the value using <data:blog.view/>.

For example ?view=hide-sidebar

Then:

<b:if cond='data:blog.view == "hide-sidebar"'>
  <!-- don't show sidebar -->
</b:if>
Related