Customizing the Contact Form
Files: src/content/sections/<language>/contact-section-two.md, src/content/sections/<language>/contact-section.md, src/config/config.toml · Skill level: Beginner
In the Tina edition, the form’s fields are under Section defaults at /admin/, and the provider under Site settings > Settings. In the Sanity edition, the fields are under Sections in the Studio, and the provider under Site settings > Settings.
Techbyte includes a built-in contact form with support for Formspree, FormSubmit, and Netlify Forms.
You can edit the fields directly in Markdown frontmatter and change the form provider from src/config/config.toml.
How to Add a New Form Input
Step 1: Locate the Contact Form Markdown File
Techbyte has two contact sections, and each has its own form fields:
| File | Shows on |
|---|---|
src/content/sections/<language>/contact-section-two.md | The /contact/ page |
src/content/sections/<language>/contact-section.md | Above Footer 1 on Home 01, the /projects/ page, and each service page |
Change the file for every language.
Step 2: Edit the Form Fields in Markdown Frontmatter
Techbyte’s default contact section includes text inputs, a standard select, a searchable select, a message box, radio buttons, a consent checkbox, and a submit button. It also renders the contact info list, whose items pull live values from settings.contactInfo in config.toml via settingFieldName:
---enable: truebadge: "CONTACT US"title: "Have Questions? Get in Touch!"list: - icon: "Navigation" settingFieldName: "address" - icon: "Phone" settingFieldName: "phone" - icon: "MailCheck" settingFieldName: "email"form: emailSubject: "New form submission from Techbyte website" submitButton: enable: true label: "Send Message" icon: enable: true name: "ArrowUpRight" position: "right" inputs: - label: "" placeholder: "Full Name *" name: "Full Name" required: true halfWidth: true - label: "" placeholder: "Email Address *" name: "Email Address" required: true type: "email" halfWidth: true - label: "" placeholder: "Project Type *" name: "Project Type" halfWidth: true dropdown: type: "search" search: placeholder: "Search project type" items: - label: "Managed Services" value: "Managed Services" - label: "Security Assessment" value: "Security Assessment"---Step 3: Add a New Input Field
To add a new field, append another object under form.inputs. Example:
- label: "" placeholder: "Website URL" name: "Website" type: "text" required: false halfWidth: trueYou can also add:
dropdown.type: ""for a standard selectdropdown.type: "search"for the searchable dropdown UI- a
textareafield by settingtag: "textarea"
Changing the Email for Form Submissions
Open src/config/config.toml and locate:
[settings] contactFormAction = "https://formsubmit.co/your_email@example.com" contactFormProvider = "formsubmit.co"Provider Examples
▶ For FormSubmit
[settings] contactFormAction = "https://formsubmit.co/your_email@example.com" contactFormProvider = "formsubmit.co"▶ For Formspree
[settings] contactFormAction = "https://formspree.io/f/your_form_id" contactFormProvider = "formspree"▶ For Netlify
[settings] contactFormAction = "/" contactFormProvider = "netlify"Techbyte’s form component reads those values in src/layouts/components/widgets/ContactForm.astro.
Bonus Tips
- Keep
namevalues meaningful because those are the submitted field keys. requiredandtypeuse normal HTML validation behavior.- The map shown on the contact page comes from
settings.contactInfo.mapLinkinconfig.toml(a Google Maps embed URL).
Do It With AI
Add a contact form field called "[LABEL]" of type [TEXT / EMAIL / DROPDOWN]. Add it under form.inputsin src/content/sections/<language>/contact-section-two.md and contact-section.md, for every language,with the label translated. Keep the same field shape as the existing inputs. Then runnpm run astro-check.