I have a bit of code that checks if a page's title has been manually set in a parent template, and if it has to use that, otherwise to use entry.title
. This is what that bit looks like:
{% set activeTitle %}
{% if pageTitle is defined %}
{{ pageTitle }}
{% else %}
{{ entry.title }}
{% endif %}
{% endset %}
I however have some pages like so:
http://example.com/foo/text.html?sectionId=6&handle=bar&entryId=170&slug=somethingclever
How do I get the entry based on the parameters that are defined in the URL? And then use this entry's entry.title
to set my page title?
pageTitle
?set entry = craft.entries.id(170).first()