Add a submissions on/off toggle with a mailing-list signup fallback
deploy / deploy (push) Successful in 4s

accepting_submissions: false in the submissions page frontmatter now
swaps the manuscript form for a closed notice and an email signup that
posts to the eec service's new /subscribe endpoint, so visitors can
still join the mailing list while submissions are paused.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 20:16:15 -04:00
parent db7a128c74
commit 4d0b976c18
2 changed files with 53 additions and 0 deletions
+1
View File
@@ -1,6 +1,7 @@
--- ---
title: "Submissions" title: "Submissions"
description: "How to submit work to Two Squirrels Press." description: "How to submit work to Two Squirrels Press."
accepting_submissions: false
--- ---
We're always glad to look at character-driven speculative fiction and poetry. Markdown is our preferred format, but we'll happily take a `.docx`, `.odt`, or most other common document formats. We're always glad to look at character-driven speculative fiction and poetry. Markdown is our preferred format, but we'll happily take a `.docx`, `.odt`, or most other common document formats.
+52
View File
@@ -2,6 +2,7 @@
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
{{ .Content }} {{ .Content }}
{{ if ne .Params.accepting_submissions false }}
<form id="submissions-form" style="margin-top:2rem;"> <form id="submissions-form" style="margin-top:2rem;">
<label for="name">Name</label> <label for="name">Name</label>
<input type="text" id="name" name="name" required autocomplete="name"> <input type="text" id="name" name="name" required autocomplete="name">
@@ -65,4 +66,55 @@
}); });
})(); })();
</script> </script>
{{ else }}
<p style="margin-top:2rem;">We're not currently accepting submissions, but you can join our mailing list to hear when that changes.</p>
<form id="subscribe-form" style="margin-top:1.5rem;">
<label for="email">Email</label>
<input type="email" id="email" name="email" required autocomplete="email">
<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">Join the mailing list</button>
</form>
<p id="subscribe-status" role="status" style="margin-top:1rem;"></p>
<script>
(function () {
var form = document.getElementById("subscribe-form");
var status = document.getElementById("subscribe-status");
form.addEventListener("submit", function (e) {
e.preventDefault();
var payload = {
email: form.email.value,
website: form.website.value
};
var submitBtn = form.querySelector("button[type=submit]");
submitBtn.disabled = true;
status.textContent = "Signing you up…";
fetch("{{ .Site.Params.eec_base_url }}/subscribe", {
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 — we'll let you know.";
return;
}
return res.text().then(function (msg) {
status.textContent = msg || "Something went wrong signing you up. Try again, or email hello@twosquirrelspress.com directly.";
});
}).catch(function () {
submitBtn.disabled = false;
status.textContent = "Something went wrong signing you up. Try again, or email hello@twosquirrelspress.com directly.";
});
});
})();
</script>
{{ end }}
{{ end }} {{ end }}