I am attempting to set a blog post's topic based on if a condition is met, so for example if the current date is greater than the set date, change the topic to "past". I cannot seem to get the topic, not sure if it is possible
{% text "your_module_name" label="What is the date? (Use the following form7at: January 1, 2014) | Please DO NOT use ordinal dates (st, nd, rd, th) or else the data can not parse the timestamps.<" value="January 1, 2016", export_to_template_context=True %}
Other
(CUSTOM HTML MODULE)
{% text "your_module_name" label="What is the date? (Use the following format: January 1, 2014) | Please DO NOT use ordinal dates (st, nd, rd, th) or else the data can not parse the timestamps.<" value="January 1, 2016", export_to_template_context=True %}
(HUBL MODULE)
{% set your_date = widget_data.your_module_name.value %}
{% set current_date = local_dt|datetimeformat('%B %e, %Y') %}
{% if current_date > your_date == true %}
<p>THis condition was correct</p>
{% set topic.name = "Past" %}
{% endif %}
@InciteJoe I dont think your going to be able to inject a topic name into the topics list.
Instead you might want to try adding "Past" as a topic to all of your post. then check the date and inside that condition set up a condition to output topics if not equal to past.
May 17, 20173:56 AM - edited May 17, 20173:57 AM
Contributor | Gold Partner
Setting blog post topic with HubL
@Jsum Thanks for your reply, I could see this working. Could you foresee any issues by setting the topic in the code? As when I go into the editor on a blog post the topic still shows as blank on the page where you select the page title, meta description etc.