I have this in the blog post page template. Basically it should be able to detect the custom page update date that will be use as sorting date of the post in the index page. I am having trouble passing variable effective_date as value.
~~~
{% set effective_date = content.publish_date %}
{% if module.show_custom_update_date %}
{% set effective_date = module.updated_date %}
{% endif %}
{% text "display_date" value=effective_date, export_to_template_context=True %}
@FMesina - I'm not entirely sure I follow the logic of what you are trying to achive here, but my eye is drawn to the statement
{% text "display_date" value=effective_date, export_to_template_context=True %}
which will take the module text field 'display_date' out of the normal evaluation flow and position it as a value settable by the page editor when editing the post. Is that part of the logic you want - or is there anothe reason for the export_to_template designation?
Sorry I have not explained it clearly. I would like to set a custom date on a the post that will be use in the index the page for sorting by date.
It will either be the publish date {% set effective_date = content.publish_date %}
or a custom update date if enabled and set by the user.
{% if module.show_custom_update_date %}
{% set effective_date = module.updated_date %}
{% endif %}.
Once set in the post. I will use it as sorting reference in the index template.
{% set sorted_contents = contents|sort(attribute='effective_date', true) %}
{% for content in sorted_contents %}
How can I have the data available in the index template? I am trying to do this line but the value shows as effective_date not the actual date that should be passed.
{% text "display_date" value=effective_date, export_to_template_context=True %}