Initial scaffold: Hugo site for west575.org
Blog with contact form and newsletter signup, structured like the other Reground-hosted sites but with its own visual identity.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.Language.LanguageCode | default "en" }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} · {{ .Site.Title }}{{ end }}</title>
|
||||
<meta name="description" content="{{ .Site.Params.description }}">
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" href="{{ "index.xml" | absURL }}">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600&family=Work+Sans:wght@400;500;600&display=swap">
|
||||
{{ $css := resources.Get "css/main.css" }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $css = $css | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
|
||||
{{ else }}
|
||||
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
|
||||
{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
<a class="skip-link" href="#main-content">Skip to content</a>
|
||||
|
||||
{{ partial "header.html" . }}
|
||||
|
||||
<main id="main-content">
|
||||
{{ block "main" . }}{{ end }}
|
||||
</main>
|
||||
|
||||
{{ partial "footer.html" . }}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,60 @@
|
||||
{{ define "main" }}
|
||||
<h1>Get in touch</h1>
|
||||
<p class="lede">Questions, corrections, or just want to say hi — I read every message myself.</p>
|
||||
|
||||
<form id="contact-form" class="contact-form">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" id="name" name="name" required autocomplete="name">
|
||||
|
||||
<label for="email">Email</label>
|
||||
<input type="email" id="email" name="email" required autocomplete="email">
|
||||
|
||||
<label for="message">Message</label>
|
||||
<textarea id="message" name="message" rows="6" required></textarea>
|
||||
|
||||
<div class="field-honeypot" aria-hidden="true">
|
||||
<label for="website">Leave this field empty</label>
|
||||
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn">Send message</button>
|
||||
</form>
|
||||
<p id="contact-status" role="status" class="contact-status"></p>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var form = document.getElementById("contact-form");
|
||||
var status = document.getElementById("contact-status");
|
||||
form.addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
if (form.website.value) return; // honeypot
|
||||
var payload = {
|
||||
name: form.name.value,
|
||||
email: form.email.value,
|
||||
message: form.message.value
|
||||
};
|
||||
var submitBtn = form.querySelector("button[type=submit]");
|
||||
submitBtn.disabled = true;
|
||||
status.textContent = "Sending…";
|
||||
fetch("{{ .Site.Params.eec_base_url }}/contact", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload)
|
||||
}).then(function (res) {
|
||||
submitBtn.disabled = false;
|
||||
if (res.ok) {
|
||||
form.reset();
|
||||
status.textContent = "Thanks — I'll get back to you soon.";
|
||||
return;
|
||||
}
|
||||
return res.text().then(function (msg) {
|
||||
status.textContent = msg || "Something went wrong sending that. Try again, or email will@west575.org directly.";
|
||||
});
|
||||
}).catch(function () {
|
||||
submitBtn.disabled = false;
|
||||
status.textContent = "Something went wrong sending that. Try again, or email will@west575.org directly.";
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
<ul class="post-list">
|
||||
{{ range .Pages }}
|
||||
<li class="post-list-item">
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
{{ if not .Date.IsZero }}
|
||||
<span class="post-date">{{ .Date.Format "January 2, 2006" }}</span>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{ define "main" }}
|
||||
<article class="post">
|
||||
<header class="post-header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ if not .Date.IsZero }}
|
||||
<p class="post-meta">
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</time>
|
||||
{{ with .Params.tags }}
|
||||
<span class="post-tags">
|
||||
{{ range . }}<span class="post-tag">{{ . }}</span>{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
</header>
|
||||
|
||||
<div class="post-body">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user