getherbie/plugin-simplecontact

Herbie 的 SimpleContact 插件。

v2.0.0 2023-01-02 11:35 UTC

This package is auto-updated.

Last update: 2024-09-11 21:51:20 UTC


README

Simplecontact 是一个 Herbie 插件,允许您在网站上添加一个简单的联系表单。此类表单包含名称、电子邮件和消息字段。

安装

此插件通过 Composer 安装。

$ composer require getherbie/plugin-simplecontact

之后,可以在配置文件中激活此插件。

plugins:
    enable:
        - simplecontact

配置

plugins.simplecontact.config 下,以下选项可用。

表单将发送到的电子邮件地址

recipient: (string)

别名模板路径到自定义表单模板

template: (string)

注意

如果您已启用页面缓存,则必须禁用它。

---
title: Contact form
cached: false
---

此外,全局配置 components.pageRendererMiddleware.cache 必须设置为 false。否则页面将从页面缓存中加载。

然后使用同名 twig 函数渲染表单。

{{ simplecontact() }}

可以在函数调用之前或之后放置额外的内容。一个完整的联系页面看起来像这样

---
title: Contact form
cached: false
---

# Contact form

Please fill in all fields of the contact form:

{{ simplecontact() }}

We can also be reached via email or phone at...    

演示

可以在 https://herbie.tebe.ch/contact 上查看实时演示。