Skip to content

Commit 22713e6

Browse files
janhohenheimVrixyzbash
authored
Add email subscription button (#1538)
Co-authored-by: Thierry Berger <[email protected]> Co-authored-by: Tau Gärtli <[email protected]>
1 parent 824a64c commit 22713e6

File tree

5 files changed

+117
-10
lines changed

5 files changed

+117
-10
lines changed

Diff for: content/news/052/index.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,16 @@ If needed, a section can be split into subsections with a "------" delimiter.
6565

6666
## Announcements
6767

68-
TODO: I'll be working on adding an email subscription this weekend, so I'll write about it here once that's done :) - Jan
68+
For years, our readers have asked for a way to subscribe to this newsletter by email. This again came up in our [recent survey][survey].
69+
We're happy to announce that this feature is now available! When you visit our [homepage],
70+
you can now scroll down and find an email subscription form.
71+
We'll send you an email whenever a new post is published, which currently is once per month.
72+
73+
The emails are currently sent from [[email protected]](mailto:[email protected]).
74+
We will switch this to an actual @gamedev.rs address in the future. Please tell us if you encounter any issues with the emails.
75+
76+
[survey]: https://gamedev.rs/blog/survey-02/
77+
[homepage]: https://gamedev.rs/
6978

7079
## Game Updates
7180

Diff for: sass/_extra.scss

+66-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ li {
1010
margin: 15px 0;
1111
}
1212

13-
pre > code {
13+
pre>code {
1414
// To avoid grey background on code blocks.
1515
background-color: inherit;
1616
}
@@ -99,31 +99,90 @@ h6:hover .anchor {
9999
margin-bottom: 0;
100100
}
101101

102-
a.btn {
102+
input, button {
103+
font-size: inherit;
104+
}
105+
106+
input {
107+
min-width: 0; // Allow the input to shrink on small devices.
108+
}
109+
110+
a.btn, // Trick to increase the specificity and win against rules such as a:visited
111+
.btn {
103112
text-decoration: none;
104113
border-radius: 3px;
105114
font-weight: 600;
106-
border: 1px solid transparent;
115+
border: none;
107116
box-sizing: border-box;
108117
display: inline-block;
109118
padding: 0.4em 2em;
119+
transition: background-color 125ms;
110120

111121
background-color: $brand-color;
112122
color: $background-color;
113123
border-color: $background-color;
114124

115125
&:hover {
116126
color: lighten($background-color, 10);
117-
border-color: $brand-color;
127+
background-color: lighten($brand-color, 5);
128+
}
129+
130+
&:active {
131+
background-color: darken($brand-color, 5);
118132
}
119133
}
120134

135+
input[type=email] {
136+
border-radius: 3px;
137+
border: 1px solid $brand-color;
138+
box-sizing: border-box;
139+
padding: .4em;
140+
}
141+
121142
// A hack for image captions.
122143
// See https://stackoverflow.com/questions/19331362/using-an-image-caption-in-markdown-jekyll
123-
img + em,
124-
a:first-child + em:last-child,
125-
video + em {
144+
img+em,
145+
a:first-child+em:last-child,
146+
video+em {
126147
display: block;
127148
text-align: center;
128149
color: $grey-color;
129150
}
151+
152+
.email-form {
153+
display: grid;
154+
margin-top: $spacing-unit;
155+
grid-template-columns: auto auto;
156+
justify-content: center;
157+
gap: .6em 1em;
158+
background-color: color-mix(in oklab, $brand-color 20%, #fff);
159+
padding: $spacing-unit * .5;
160+
align-items: center;
161+
border-radius: 3px;
162+
163+
.email-form__icon {
164+
width: 5em;
165+
height: 5em;
166+
--icon-stroke-color: #{$brand-color};
167+
--icon-fill-color: rgba(255, 255, 255, .4);
168+
}
169+
170+
.email-form__description {
171+
max-width: 18em;
172+
}
173+
174+
.email-form__input {
175+
grid-column: 1 / 3;
176+
}
177+
}
178+
179+
.email-input {
180+
display: grid;
181+
grid-template-columns: repeat(2, auto);
182+
gap: 5px;
183+
184+
label {
185+
grid-column: 1 / 3;
186+
font-size: .8em;
187+
}
188+
}

Diff for: static/intro-icons.svg

+17-1
Loading

Diff for: templates/includes/email_signup.html

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<form action="https://gamedev.us22.list-manage.com/subscribe/post?u=3b2317bf9350c11e252162541&amp;id=aaf37783ec&amp;f_id=0011cde1f0" method="post" name="mc-embedded-subscribe-form">
2+
<div class="email-form">
3+
<svg class="email-form__icon" aria-hidden="true">
4+
<svg><use xlink:href="{{ get_url(path='intro-icons.svg#incoming-envelope') }}"></use></svg>
5+
</svg>
6+
7+
<div class="email-form__description">
8+
Get the Rust GameDev Workgroup’s monthly newsletter delivered directly to your inbox.
9+
</div>
10+
11+
<div class="email-form__input email-input">
12+
<label for="email-input">Email Address</label>
13+
<input type="email" inputmode="email" name="EMAIL" id="email-input" placeholder="[email protected]" required>
14+
<button type="submit" name="subscribe" class="btn">Subscribe</button>
15+
16+
<div style="position: absolute; left: -5000px;" aria-hidden="true">
17+
<input type="text" name="b_3b2317bf9350c11e252162541_aaf37783ec" tabindex="-1" value="">
18+
</div>
19+
</div>
20+
</div>
21+
</form>
22+

Diff for: templates/includes/home.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ <h2 class="post-list-heading">{{ section.title | default(value="Latest Blog Post
3939
<a class="btn" id="all-blog-posts" href="{{ get_url(path='blog/') }}">All Blog Posts</a>
4040
<a href="{{ get_url(path='rss.xml') }}">
4141
<svg class="svg-icon orange"><use xlink:href="{{ get_url(path='minima-social-icons.svg#rss') }}"></use></svg><span>Subscribe</span>
42-
</a>
42+
</a>
43+
{% include "includes/email_signup.html" %}
4344
</p>
4445
</div>

0 commit comments

Comments
 (0)