This commit is contained in:
parent
a5869d2b83
commit
b8cd4f0789
5 changed files with 16 additions and 11 deletions
|
|
@ -1,11 +1,10 @@
|
||||||
# Hosted form endpoint used by the contact form.
|
# Optional override for the hosted contact-form endpoint configured in src/config/contact.ts.
|
||||||
# Examples: Formspree, Basin, Getform, or a self-hosted POST endpoint.
|
|
||||||
PUBLIC_CONTACT_FORM_ENDPOINT=
|
PUBLIC_CONTACT_FORM_ENDPOINT=
|
||||||
|
|
||||||
# Optional comma-separated fallback recipients used by the mailto fallback.
|
# Optional comma-separated fallback recipients used by the mailto fallback.
|
||||||
PUBLIC_CONTACT_RECIPIENTS=directors@familyfed.ie,info@familyfed.ie,media@familyfed.ie
|
PUBLIC_CONTACT_RECIPIENTS=directors@familyfed.ie,info@familyfed.ie,media@familyfed.ie
|
||||||
|
|
||||||
# Optional admin URL for reviewing stored contact form submissions.
|
# Optional override for the submissions URL configured in src/config/contact.ts.
|
||||||
PUBLIC_CONTACT_SUBMISSIONS_URL=
|
PUBLIC_CONTACT_SUBMISSIONS_URL=
|
||||||
|
|
||||||
# Optional Plausible analytics configuration.
|
# Optional Plausible analytics configuration.
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,15 @@ repository and deploy as usual.
|
||||||
|
|
||||||
## Contact form
|
## Contact form
|
||||||
|
|
||||||
Set `PUBLIC_CONTACT_FORM_ENDPOINT` during the build to make the contact form
|
The default hosted form endpoint and submissions inbox are configured in
|
||||||
send real submissions through a hosted form provider such as Formspree, Basin,
|
`src/config/contact.ts`. The deployed form sends submissions through Formspree.
|
||||||
Getform, or a self-hosted endpoint.
|
Set `PUBLIC_CONTACT_FORM_ENDPOINT` during the build only when overriding the
|
||||||
|
committed endpoint with another Formspree form or hosted provider.
|
||||||
|
|
||||||
Optional variables:
|
Optional variables:
|
||||||
|
|
||||||
- `PUBLIC_CONTACT_RECIPIENTS`: comma-separated mail fallback recipients.
|
- `PUBLIC_CONTACT_RECIPIENTS`: comma-separated mail fallback recipients.
|
||||||
- `PUBLIC_CONTACT_SUBMISSIONS_URL`: admin dashboard URL for form submissions.
|
- `PUBLIC_CONTACT_SUBMISSIONS_URL`: override for the admin submissions-inbox URL.
|
||||||
|
|
||||||
If no endpoint is configured, the form falls back to opening the visitor's email
|
If no endpoint is configured, the form falls back to opening the visitor's email
|
||||||
application with the message filled in.
|
application with the message filled in.
|
||||||
|
|
|
||||||
3
src/config/contact.ts
Normal file
3
src/config/contact.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
export const defaultContactFormEndpoint = "https://formspree.io/f/mjgqnrvj";
|
||||||
|
export const defaultContactSubmissionsUrl = "https://formspree.io/forms/mjgqnrvj/submissions";
|
||||||
|
export const defaultContactRecipients = "directors@familyfed.ie,info@familyfed.ie,media@familyfed.ie";
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
---
|
---
|
||||||
import { getArchiveEntries } from "../../lib/archive";
|
import { getArchiveEntries } from "../../lib/archive";
|
||||||
import { speechAdminEntryFromArchiveEntry } from "../../lib/admin-speeches";
|
import { speechAdminEntryFromArchiveEntry } from "../../lib/admin-speeches";
|
||||||
|
import { defaultContactFormEndpoint, defaultContactSubmissionsUrl } from "../../config/contact";
|
||||||
import { calendarEvents, recurringCalendarEvents } from "../../data/events";
|
import { calendarEvents, recurringCalendarEvents } from "../../data/events";
|
||||||
|
|
||||||
const entries = await getArchiveEntries();
|
const entries = await getArchiveEntries();
|
||||||
const blogEntries = entries.filter((entry) => entry.data.type === "blog");
|
const blogEntries = entries.filter((entry) => entry.data.type === "blog");
|
||||||
const speechEntries = entries.filter((entry) => entry.data.type === "speech");
|
const speechEntries = entries.filter((entry) => entry.data.type === "speech");
|
||||||
const contactFormEndpoint = import.meta.env.PUBLIC_CONTACT_FORM_ENDPOINT ?? "";
|
const contactFormEndpoint = import.meta.env.PUBLIC_CONTACT_FORM_ENDPOINT || defaultContactFormEndpoint;
|
||||||
const contactSubmissionsUrl = import.meta.env.PUBLIC_CONTACT_SUBMISSIONS_URL ?? "";
|
const contactSubmissionsUrl = import.meta.env.PUBLIC_CONTACT_SUBMISSIONS_URL || defaultContactSubmissionsUrl;
|
||||||
const analyticsDashboardUrl = import.meta.env.PUBLIC_ANALYTICS_DASHBOARD_URL ?? "";
|
const analyticsDashboardUrl = import.meta.env.PUBLIC_ANALYTICS_DASHBOARD_URL ?? "";
|
||||||
const plausibleDomain = import.meta.env.PUBLIC_PLAUSIBLE_DOMAIN ?? "";
|
const plausibleDomain = import.meta.env.PUBLIC_PLAUSIBLE_DOMAIN ?? "";
|
||||||
const today = new Date().toISOString().slice(0, 10);
|
const today = new Date().toISOString().slice(0, 10);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
---
|
---
|
||||||
import SiteLayout from "../components/SiteLayout.astro";
|
import SiteLayout from "../components/SiteLayout.astro";
|
||||||
import TwoColumnPage from "../components/TwoColumnPage.astro";
|
import TwoColumnPage from "../components/TwoColumnPage.astro";
|
||||||
|
import { defaultContactFormEndpoint, defaultContactRecipients } from "../config/contact";
|
||||||
import articleHtml from "../content/pages/contact.html?raw";
|
import articleHtml from "../content/pages/contact.html?raw";
|
||||||
|
|
||||||
const contactFormEndpoint = import.meta.env.PUBLIC_CONTACT_FORM_ENDPOINT ?? "";
|
const contactFormEndpoint = import.meta.env.PUBLIC_CONTACT_FORM_ENDPOINT || defaultContactFormEndpoint;
|
||||||
const contactRecipients = import.meta.env.PUBLIC_CONTACT_RECIPIENTS ?? "directors@familyfed.ie,info@familyfed.ie,media@familyfed.ie";
|
const contactRecipients = import.meta.env.PUBLIC_CONTACT_RECIPIENTS || defaultContactRecipients;
|
||||||
const contactFormAction = contactFormEndpoint || `mailto:${contactRecipients}`;
|
const contactFormAction = contactFormEndpoint || `mailto:${contactRecipients}`;
|
||||||
const contactFormConfig = JSON.stringify({
|
const contactFormConfig = JSON.stringify({
|
||||||
endpoint: contactFormEndpoint,
|
endpoint: contactFormEndpoint,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue