Open navClose nav

File Upload Field

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2018/01/file-preview.png

Options

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2018/01/file-options.png

  • General
    • Label — the human-friendly label shown above the input field in the editor.
    • Name — the key stored in your content’s front matter, used to access it in your templates.
    • Description — a human friendly description of what the field does and/or instructions for your editors.
    • Hidden — hides the field in the editor, but allows developers to set default values or maintain the field for legacy purposes.
  • Validation
    • Max File Size — prevent files larger than this value from being uploaded. Value is in MB (Megabytes).
  • Default — supply a default image.

Templating

If you have a text field in your template, you can access it in your templates using the field’s name:

Hugo

<img src="{{ .Params.banner | relURL }}">

Use the relURL filter to automatically append your site’s baseURL

Jekyll

<img src="{{ page.banner | relative_url }}">

Use the relative_url filter to automatically append your site’s url and baseURL

Config Files

You can configure this field in Front Matter Template Config Files as follows:

type: file
name: [String]
label: [String]
description: [String]
hidden: [true|false]
default: [String]
config:
  maxSize: [Number] 

Example

type: file
name: banner
label: Banner
description: Provide a banner image for this post
hidden: false
default "/uploads/2017/12/31/placeholder.jpg"
config:
  maxSize: 10

Last updated on December 31, 2017