Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog Post - Support for Embed Newsletter Form #1818

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ assetDir = "src"
site_banner_enabled = false

github_username = "letsencrypt"
mastodon_username = "letsencrypt"
linkedin_url = "https://www.linkedin.com/company/lets-encrypt/"
crowdfunding_url = "https://www.generosity.com/community-fundraising/make-a-more-secure-web-with-let-s-encrypt"

Expand Down
3 changes: 0 additions & 3 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<body>
{{ partial "header" . }}
{{ block "main" . }}{{ end }}
{{ if .Page.Params.should_display_prominent_newsletter_form }}
{{ partial "newsletter-form" . }}
{{ end }}
{{ partial "footer" . }}
</body>
</html>
6 changes: 3 additions & 3 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{{- range .Page.Translations -}}
{{- if eq "en" .Language.Lang -}}
{{- $currentpage_en := .Page -}}

{{- if.Page.Params.show_lastmod -}}
{{- partial "lastmod" . -}}
{{- end -}}
Expand Down Expand Up @@ -81,11 +81,11 @@
{{- i18n "english_is_canonical" | safeHTML -}}
</div>
{{- end -}}

{{- if.Page.Params.show_lastmod -}}
{{- partial "lastmod" . -}}
{{- end -}}

{{- partial "outdated_translation" . -}}

{{- $scratch := newScratch -}}
Expand Down
24 changes: 12 additions & 12 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{{ if and (ne .Section "documents") (.Page.Params.display_newsletter_embed) }}
<div class="wrapper">
<div class="newsletter-form-wrapper">
{{ partial "newsletter-form" . }}
</div>
</div>
{{ end }}


{{ if and (ne .Section "docs") (ne .Section "documents") (not .Params.no_donate_footer) }}
<div class="donate-footer">
<div class="wrapper text-center">
Expand All @@ -9,6 +18,8 @@ <h2>{{ i18n "footer_support_us" }}</h2>
</div>
{{ end }}



{{ if ne .Section "documents" }}
<footer class="site-footer">

Expand All @@ -35,9 +46,6 @@ <h2>{{ i18n "footer_support_us" }}</h2>
<span itemprop="addressCountry">USA</span>
</span>
</p>
</div>

<div class="footer-col footer-col-1">
<ul class="social-media-list">
{{ with .Site.Params.github_username }}
<li>
Expand All @@ -56,20 +64,12 @@ <h2>{{ i18n "footer_support_us" }}</h2>
</a>
</li>
{{ end }}
{{ with .Site.Params.mastodon_username }}
<li>
<a rel="me" href="https://infosec.exchange/@{{ . }}">
<i class="fab fa-mastodon" aria-hidden="true"></i>
<span class="username">Mastodon</span>
</a>
</li>
{{ end }}
</ul>
{{ i18n "footer_policies" | safeHTML }}
</div>

<div class="footer-col footer-newsletter-col footer-col-3">
{{ if not .Page.Params.should_display_prominent_newsletter_form }}
{{ if and (not .Page.Params.should_display_prominent_newsletter_form) (not .Page.Params.display_newsletter_embed) }}
<h6>{{ i18n "subscribe_to_newsletter_headline" }}</h6>
{{ partial "newsletter-form" . }}
{{ end }}
Expand Down
8 changes: 8 additions & 0 deletions layouts/partials/newsletter-embed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- Newsletter Embed -->
<div class="newsletter-embed-container" style="margin: 2em 0;">
<iframe src="https://outreach.abetterinternet.org/l/1011011/2025-01-14/31v6r"
style="width: 100%; height: 150px; border: none; overflow: hidden;"
scrolling="no"
loading="lazy">
</iframe>
</div>
15 changes: 12 additions & 3 deletions layouts/partials/newsletter-form.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<div class="wrapper">
<iframe src="https://outreach.abetterinternet.org/l/1011011/2023-02-16/6l51" height="200" style="width: 100%; border: 0"></iframe>
</div>
<iframe id="newsletter-iframe" src="https://outreach.abetterinternet.org/l/1011011/2025-01-14/31v6r" style="width: 100%; border: 0; overflow: hidden;"></iframe>
<script>
let hasResized = false;
window.addEventListener('message', function(e) {
if (hasResized) return; // Only allow one resize
if (e.origin !== 'https://outreach.abetterinternet.org') return;
if (e.data && typeof e.data === 'object' && e.data.type === 'resize' && e.data.height) {
hasResized = true;
document.getElementById('newsletter-iframe').style.height = (e.data.height + 20) + 'px';
}
});
</script>
66 changes: 7 additions & 59 deletions src/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -299,50 +299,17 @@ html[dir="rtl"] .social-media-list {
.footer-col-wrapper {
font-size: 15px;
color: $text-color;
margin-left: -$spacing-unit / 2;
@extend %clearfix;
}
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: $spacing-unit;

.footer-col {
float: left;
margin-bottom: $spacing-unit / 2;
padding-left: $spacing-unit / 2;
}

/* 2 Column Version
.footer-col-1 {
width: -webkit-calc(35% - (#{$spacing-unit} / 2));
width: calc(35% - (#{$spacing-unit} / 2));
}

.footer-col-2 {
width: -webkit-calc(65% - (#{$spacing-unit} / 2));
width: calc(65% - (#{$spacing-unit} / 2));
}

@include media-query($on-laptop) {
.footer-col-1,
.footer-col-2 {
width: -webkit-calc(50% - (#{$spacing-unit} / 2));
width: calc(50% - (#{$spacing-unit} / 2));
@include media-query($on-palm) {
grid-template-columns: 1fr;
}
}
*/

// 3 column version

.footer-col-1 {
width: -webkit-calc(25% - (#{$footer-spacing-unit} / 3));
width: calc(25% - (#{$footer-spacing-unit} / 3));
}

.footer-col-2 {
width: -webkit-calc(40% - (#{$footer-spacing-unit} / 3));
width: calc(40% - (#{$footer-spacing-unit} / 3));
}
.footer-col-3 {
width: -webkit-calc(33.3% - (#{$footer-spacing-unit} / 3));
width: calc(33.3% - (#{$footer-spacing-unit} / 3));
.footer-col {
margin-bottom: $spacing-unit / 2;
}

.footer-newsletter-col {
Expand All @@ -360,25 +327,6 @@ html[dir="rtl"] .social-media-list {
}
}

@include media-query($on-laptop) {
.footer-col-1,
.footer-col-2,
.footer-col-3 {
width: -webkit-calc(33.3% - (#{$footer-spacing-unit} / 3));
width: calc(33.3% - (#{$footer-spacing-unit} / 3));
}
}

@include media-query($on-palm) {
.footer-col {
float: none;
width: -webkit-calc(100% - (#{$footer-spacing-unit} / 3));
width: calc(100% - (#{$footer-spacing-unit} / 3));
}
}



/**
* Page content
*/
Expand Down
6 changes: 6 additions & 0 deletions src/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ div[data-netlify-site-id] {
}
}

.newsletter-form-wrapper {
border: 1px solid #ccc;
border-radius: 10px;
padding: 20px;
}


// Import partials from `sass_dir` (defaults to `_sass`)
@import "fonts", "pure", "pure-fix", "base", "layout", "nav",
Expand Down
Loading