Hello pamtbaau,
Thank you for reading ^^
The Comments plugin was my first guess, but after reading throught learn.getgrav.org and from this forum, I figured that guestbook suited best my purpose. So no, I haven’t tried to achieve anything with this plugin for now.
My site is a one page site, as it was designed to be a static page. So if the guestbook/comments is/are on another page , maybe it would be better. But maybe the form to fill the guestbook/comments section could be a module in the home page …
About sharing what I’ve tried, that is not a problem, but how ? There are several state …
My first attempt was to add a module in my home page :
user/pages/01.home/modular.md :
title: 'Title
menu: Home
onpage_menu: true
content:
items: '@self.modular'
order:
by: default
dir: asc
custom:
- _header
- _services
- _portfolio
- _about
- _team
- _clients
- _guestbook
I added the folder user/pages/01.home/_guestbook/
containing guestbook.md :
---
title: Guestbook
menu: Guestbook
form:
name: guestbook
fields:
- name: author
label: Nom
placeholder: Saisissez un nom ou un surnom qui me permettra de vos reconnaitre
autofocus: on
autocomplete: on
type: text
validate:
required: true
pattern: '^((?!https?:\/\/)(?:\R|.))*$'
message: "Additional information field can't contain links"
- name: email
label: Courriel
placeholder: Saisissez votre adresse de courriel
type: email
validate:
required: true
- name: avis
label: Message
placeholder: Saisissez votre message
type: textarea
validate:
required: true
pattern: '^((?!https?:\/\/)(?:\R|.))*$'
message: "Additional information field can't contain links"
- name: date
type: hidden
process:
fillWithCurrentDateTime: true
buttons:
- type: submit
value: Submit
process:
- email:
subject: "[Site Guestbook] {{ form.value.name|e }}"
body: "{% include 'forms/data.html.twig' %}"
- save:
filename: messages.yaml
operation: 'add'
- message: Thank you for writing your message!
---
## Livre d'Or
### Cet espace est dédié aux personnes ayant déjà fait appel à mes services
This first attempt resulted in an error message about a missing guestbook.html.twig, so I copied it from
user/plugins/guestbook/templates/
to
user/themes/mytheme/templates/modular/
It worked, I had the field and the submit button, but with the colors picked up for my other form (contact form), and it was not centered, so sketchy but working except I hadn’t fill a valid email in the ‘to’ and ‘from’ field in the email plugin …
Also, it was using the placeholder from my contact form … I’ve since renamed the type:textarea ; label:message
in ‘avis’, but it is still the same output.
At this point, I sayed to myself: this has to be related with the fact that the plugin is designed for page, and not for modules, so I tried to set a page with the same content, and get what you see in the image …
Does this help you with your questions ?