Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Hero_image: "any" ***.jpg

Started by Alex 8 years ago · 0 replies · 598 views
8 years ago

I'm using Grav Blog Site Skeleton and the Add Page By Form plugin.

My form page for creating blog item:

YAML
title: 'Создать новость'
pageconfig:
    parent: /blog
    include_username: true
    overwrite_mode: false
pagefrontmatter:
    template: item
    title: 'My new Blog post'
    hero_classes: 'text-light title-h1h2 overlay-dark-gradient hero-large parallax'
    hero_image: road.jpg
    show_sidebar: true
    show_breadcrumbs: true
    show_pagination: true
    taxonomy:
        category: blog
        tag:
            - journal
            - guest
form:
    name: addpage.blogpost
    fields:
        -
            name: author
            label: Автор
            type: text
        -
            name: title
            label: Заголовок
            type: text
        -
            name: content
            label: 'Текст сообщения'
            type: textarea
            size: long
            classes: editor
        -
            name: images
            label: 'Загрузить изображение'
            type: file
            multiple: false
            accept:
                - image/jpeg
            destination: '@self'
            random_name: true
        -
            name: honeypot
            type: honeypot
    buttons:
        -
            type: submit
            value: Опубликовать
    process:
        -
            addpage: null
        -
            redirect: /blog

When creating a new item through the "Add Page By Form" plug-in, a random image is created in the blog page, a sample: "\pages\01.blog\new-item\p5tcqgycawmvpzo.jpg".

I had a problem with the parameter "hero_image: .jpg". How to open an image with any name found in the blog folder "\pages\01.blog\new-item\ .jpg".

YAML
template: item
title: 'New Item'
hero_classes: 'text-light title-h1h2 overlay-dark-gradient hero-large parallax'
hero_image: road.jpg
show_sidebar: true
show_breadcrumbs: true
show_pagination: true
taxonomy:
    category: blog
    tag:
        - journal
        - guest
username: ''
author: 'Autor Aaa'
images:
    -
        name: qbofci7urivvfmt.jpg
        type: image/jpeg
        size: 66722
        path: /user/pages/01.blog/new-item/qbofci7urivvfmt.jpg

Suggested topics

Topic Participants Replies Views Activity
General · by jeremycherfas, 1 week ago
5 192 28 minutes ago
General · by lynbor, 6 days ago
2 128 3 days ago
General · by Old Man Umby, 1 week ago
1 103 1 week ago
General · by Sebastian, 2 weeks ago
1 127 2 weeks ago
General · by Andy Miller, 3 weeks ago
0 251 3 weeks ago