oc-checkcontent
Check if content file exists
Usage:
Content file
Prevent error if choosing non-existing content file (and use :slug instead of content file name)
{% if content_exists( this.param.slug ~ '.htm') %} {% content this.param.slug %} {% else %} {% content 'default' %} {% endif %}
Media file
Check if media file is present in the media folder
{% set img = 'gallery/' ~ 'image.png' %} {% if media_exists( img ) %} <img src="{{ img|media }}" alt=""> {% else %} <p>no image found</p> {% endif %}
Check Content / Media
Check if content file exists (with a small modification you can check existence of any file from October file system)
Use :slug instead of content file name One universal page for all contents you have:
/page/:slug
{% if content_exists( this.param.slug ~ '.htm') %} {% content this.param.slug %} {% else %} {% content 'default' %} {% endif %}
-
Wiego Bergsma
Found the plugin useful on 4 Jan, 2021
Nice plugin, thanks!
-
1.0.4 |
Added partial check Mar 28, 2022 |
---|---|
1.0.3 |
Added media check Jun 06, 2020 |
1.0.2 |
Added readme Feb 07, 2020 |
1.0.1 |
Initialize plugin. Jan 30, 2020 |