Image folder
All images are kept in the images
folder. Because the site content was originally exported from Confluence,
most of the images are in the top-level and have automatically-generatedd numeric names, for example 4849751.png
. However, images used in the LoopBack 4 docs are in a sub-folder, images/lb4
; images used in the “overview” pages are in images/overview
. As a best practice, create a new folder for new
releases (e.g. LoopBack 5, or other projects).
Using images
You can include images in a page using the standard markdown syntax; for example:
![LoopBack 4 Architecture](/images/lb4/loopback-overview.png "LoopBack 4 Architecture")
The result is:
Image include template
Instead of using Markdown or HMTL syntax directly in your page for images, you can also use the image “include template” that allows you to pass some parameters that provide additional settings. For example:
{% include image.html file="loopback_logo.png" url="http://loopback.io" alt="LoopBack" caption="This is a sample caption" %}
Here’s the result:
<figcaption>This is a sample caption</figcaption></figure>
The following table summarizes the image include template properties:
Property | description |
---|---|
file | The name of the file. Store it in the /images folder. If you want to organize your images in subfolders, reference the subfolder path here, like this: mysubfolder/jekyllrb.png |
url | Whether to link the image to a URL |
alt | Alternative image text for accessibility and SEO |
caption | A caption for the image |
max-width | a maximum width for the image (in pixels). Just specify the number, not px. |
The properties of the include get populated into the image.html template.
Inline image includes
For inline images, such as with a button that you want to appear inline with text, use the inline_image.html include, like this:
Click the **Expand** icon {% include inline_image.html
file="4849751.png" alt="SDK button" %}
Click the Expand icon
The inline_image.html include properties are as follows:
Property | description |
---|---|
file | The name of the file |
type | The type of file (png, svg, and so on) |
alt | Alternative image text for accessibility and SEO |
SVG Images
You can also embed SVG graphics. If you use SVG, you need to use the HTML syntax so that you can define a width/container for the graphic. Here’s a sample embed:
{% include image.html file="overview/book.svg" url="http://looopback.io" alt="Book icon" caption="A book icon" max-width="600" %}
Here’s the result: