Files Module v2.4

Ryan Thompson Releases


We've made a small update to the files module that makes controlling image related SEO easier.

Default Alt Tags

Pyro has defaulted image alt tags for a while by converting decently_named_file.jpg into alt="Decently Named File". However decently named files are rare so we added alt tag control to the files module along with title, description, and captions.

This makes it easier to put more of your SEO tasks on autopilot when you let Pyro generate the code for you:

{{ img('theme::screwy-file-name-2017.jpg') }}

The above example will now produce an image tag, using relative paths, with the alt tag as defined by the files module or the file name if not defined otherwise.

You can always override this behavior by specifying your own with another field (for example) by specifying it manually:

{{ img('theme::screwy-file-name-2017.jpg').alt(page.title.value)|raw }}

Repetitive Fields

Often times images are accompanied by captions, titles, and descriptions as well. We've moved these fields into the files module to reduce the need for creating the same fields for every project.

{% for image in page.images %}
    <figure>
        {{ image.make.height(200)|raw }}
        {#<img src="example_image.jpg" title="A picture of a rock" alt="Another great example" height="200">#}
        <figcaption>{{ image.caption }}</figcaption>
    </figure>
{% endfor %}

Upgrading

Easy! Update your project's composer.json to require the new version.

Then migrate php artisan migrate --addon=anomaly.module.files

Enjoy!

- Ryan


No Comments


Leave a Comment