feature: Wire up contact and thank you pages, add showInNav meta functionality

This commit is contained in:
Keith Solomon
2025-04-21 15:10:28 -05:00
parent 1a9b58d7d7
commit 29b398921b
20 changed files with 280 additions and 533 deletions

View File

@@ -6,6 +6,7 @@
<meta charset="UTF-8">
<title>{{ .Title }}</title>
<link rel="stylesheet" href="/assets/style.css">
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon">
</head>
<body>
@@ -22,12 +23,18 @@
{{ template "category_content" . }}
{{- else if eq .PageTemplate "contact_page" -}}
{{ template "contact_content" . }}
{{- else if eq .PageTemplate "thanks_page" -}}
{{ template "thanks_content" . }}
{{- else -}}
<p>Unknown PageTemplate: {{ .PageTemplate }}</p>
{{- end -}}
</main>
{{ template "footer" . }}
{{- if eq .PageTemplate "contact_page" -}}
<script src="/assets/contact.js" defer></script>
{{- end -}}
</body>
</html>
{{ end }}

View File

@@ -3,35 +3,40 @@
{{ end }}
{{ define "contact_content" }}
<h1 class="text-2xl font-bold mb-4">Contact Me</h1>
<article>
<h1 class="text-2xl font-bold mb-4">Contact Me</h1>
<form action="https://api.staticforms.xyz/submit" method="POST" class="space-y-4 max-w-xl">
<!-- StaticForms API Key -->
<input type="hidden" name="accessKey" value="sf_5m86ek16hmele1jlkl62ghml" />
<form action="https://api.staticforms.xyz/submit" method="POST" class="space-y-4 max-w-xl">
<!-- StaticForms API Key -->
<input type="hidden" name="accessKey" value="sf_5m86ek16hmele1jlkl62ghml" />
<!-- Optional redirect after success -->
<!-- <input type="hidden" name="redirectTo" value="https://yourdomain.com/thanks/" /> -->
<!-- Optional redirect after success -->
<input type="hidden" name="redirectTo" value="/thanks/" />
<label class="block">
<span class="block text-sm font-medium">Your Name</span>
<input type="text" name="name" required class="w-full border p-2 rounded" />
</label>
<label>
<span>Name</span>
<input id="name" type="text" name="name" required class="w-full border p-2 rounded" />
<span class="text-red-600 text-sm hidden" data-error="name"></span>
</label>
<label class="block">
<span class="block text-sm font-medium">Email Address</span>
<input type="email" name="email" required class="w-full border p-2 rounded" />
</label>
<label>
<span>Email</span>
<input id="email" type="email" name="email" required class="w-full border p-2 rounded" />
<span class="text-red-600 text-sm hidden" data-error="email"></span>
</label>
<label class="block">
<span class="block text-sm font-medium">Message</span>
<textarea name="message" rows="5" required class="w-full border p-2 rounded"></textarea>
</label>
<label>
<span>Message</span>
<textarea id="message" name="message" rows="5" required class="w-full border p-2 rounded"></textarea>
<span class="text-red-600 text-sm hidden" data-error="message"></span>
</label>
<!-- reCAPTCHA if configured in dashboard -->
<!-- <div class="g-recaptcha" data-sitekey="your-recaptcha-site-key"></div> -->
<!-- reCAPTCHA if configured in dashboard -->
<!-- <div class="g-recaptcha" data-sitekey="your-recaptcha-site-key"></div> -->
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
Send Message
</button>
</form>
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
Send Message
</button>
</form>
</article>
{{ end }}

View File

@@ -1,6 +1,6 @@
{{ define "header" }}
<header id="site_head">
<h1 class="text-white text-40px hover:text-primary-200"><a href="/">Go SSG</a></h1>
<h1><a href="/">Go SSG</a></h1>
<nav>
<ul class="list-none">

View File

@@ -0,0 +1,10 @@
{{ define "thanks_page" }}
{{ template "base" . }}
{{ end }}
{{ define "thanks_content" }}
<div class="max-w-2xl mx-auto mt-10 text-center">
<h1 class="text-3xl font-bold text-green-700 mb-4">Thanks for reaching out!</h1>
<p class="text-lg">Your message has been received. Ill get back to you as soon as I can.</p>
</div>
{{ end }}