Merge pull request #170 from Jossnaz/image-doc

/content/docs/templates/imageops added way to access single images an…
This commit is contained in:
Joseph Nix 2017-12-21 15:41:47 -06:00 committed by GitHub
commit 2e2923a7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -23,6 +23,25 @@ the query. For instance this iterates over all attached images of a page:
<div class="image"><img src="{{ image|url }}"></div> <div class="image"><img src="{{ image|url }}"></div>
{% endfor %} {% endfor %}
``` ```
<br/>
To access images from a different content folder, you would use:
```html+jinja
{% for image in site.query('/myfolder').attachments.images %}
<div class="image"><img src="{{ image|url }}"></div>
{% endfor %}
```
<br/>
To retrieve only a specific image or attachment with a certain name you would use
```html+jinja
{% set my_image site.query('/myfolder').attachments.get('imagenameexample.jpg') %}
<div class="image"><img src="{{ my_image|url }}"></div>
```
## Accessing Image Data ## Accessing Image Data