Skip to content
Snippets Groups Projects
image.html 998 B
Newer Older
Erxleben, Fredo's avatar
Erxleben, Fredo committed
    Includes an image of a person on the page.
    
    Assumes that there is a variable "person" already defined.  
    It holds a key "image" and an associated value which is a subpath to the 
    image file from the site's image directory (see _config.yml).
    If the image could not be found for any reason, a default avatar image 
    will be substituted.
{%- assign person = include.person -%}
{%- if person -%}
    {%- if person.image -%}
        {%- assign image-url = site.directory.images
Erxleben, Fredo's avatar
Erxleben, Fredo committed
                            | append: "members/"
                            | append: person.image -%}
Erxleben, Fredo's avatar
Erxleben, Fredo committed
        <img    class="portrait"
                src="{{ image-url | strip | relative_url }}" 
                alt="Picture of {{ person.name }}">
    {%- else -%}
        <div class="portrait"></div>
    {%- endif -%}
{%- else -%}
Erxleben, Fredo's avatar
Erxleben, Fredo committed
    <!--
        WARNING: team_card/image.html was included, 
        but no person object was defined 
    -->