Hello, I read the documentation, looked at the examples, but I still can't make my own page template.
What I want to do:
create own fields for the modular page. I looked for an example in the video and did not find it.
I’m looking at the structure of the template Quark, and I don’t understand how to use it as an example to make tabs for a module page with their own fields.
@NataliaB, You might want to download the "One-Page Site" skeleton. It contains a sample modular page with modules. Then take a look at /themes/blueprints/modular/features.yaml. This form creates its own 'Feature' tab in Admin with its own fields.
How correctly duplicate features.yaml with custom fields.
1) I create a services.yaml with fields text like in features.yaml
How display Services tab in admin panel on page setting ?
Oh, I miss services.html.twig
Now I can echo images from my field
This my services.yaml
YAML
title:Services'@extends':defaultform:fields:tabs:type:tabsactive:1fields:content:type:tab## Add your custom fields here.# These fields will be available in the page's Content tab# inside the Admin Panel.#fields:## Custom text field#header.custom.textField:type:textlabel:Custom text field## Cover image#header.custom.coverImage:type:filelabel:Cover imagedestination:'self@'multiple:falseaccept:-image/*
and my services.twig.html
HTML
<divclass="container"><!-- custom text field content from default.yaml blueprints file --><h1class="customTitle"> {{page.header.custom.textField}}
</h1><!-- custom image select field content from default.yaml blueprints file useful for including a specific image somewhere. since it relative, we can just use the twig tag here in an img html tag --><imgsrc=" {{page.header.custom.coverImage}} "/><!-- main content / markdown area! --><divclass="mainContent"> {{page.content}}
</div></div>
On web site:
Some custom text from my fields Text
<img src="Array">
<p>content from page here</p> (but why show on page with <p> ?)
You are using a File field and according the docs:
The file field is intended to be used by configuration , theme , and plugins blueprints, NOT page blueprints . For pages, you should use the existing pagemedia field and then utilize the filepicker field to select the files.
When using a File field, {{page.header.custom.coverImage}} is indeed an array. Have a look at your *.md
{{ page.content }} should be {{ page.content | raw }}
<img src= " {{page.header.custom.coverImage}} " />
should be: <img src= "{{ page.url }}/{{ page.header.custom.coverImage }}" />
or maybe: {{ (page.media.images|first).html | raw }}
but why show on page with
I'm afraid I do not understand you last remark.
Maybe just a matter proper formatting using triple backticks (``) and<instead of<`.
@NataliaB, Then please pick one and mark it as solution...
The forum is a two-way street where everyone has its share. It is not only for the benefit of people asking questions. The idea is that the asker also gives feedback on proposes solution (does it work or not) and mark a post as solved if a solution has been provided. By doing so, the knowledgebase in enriched by both answerers and askers.