From 0ac9e447ca28a55d61dd5a675fb446e0670719b1 Mon Sep 17 00:00:00 2001 From: Andrew Boyer Date: Wed, 19 Jun 2024 18:49:19 +0100 Subject: [PATCH] Added support for a newsletter (#2517) In reference to idea: https://github.com/alshedivat/al-folio/discussions/2097 In reference to request: https://github.com/alshedivat/al-folio/issues/923#issuecomment-2171924663 Added support to integrate a [loops.so](https://loops.so/) mailing list into the site. To use, you need to enable `newsletter` in `_config.yml`. You also must specify a loops endpoint (although I think any mailing list endpoint can work), which you can get when you set up a mailing list on loops. More documentation on loops: [here](https://loops.so/docs/forms/custom-form). Once that is enabled, the behavior is different depending on how you specified your footer to behave in `_config.yml`. If `footer_fixed: true`, then the sign up will appear at the bottom of the about page, as well as at the bottom of blog posts, if you enable `related_posts`. If `footer_fixed: false`, then the newsletter signup will be in the footer (on every page), like it is in on [my website](https://asboyer.com). I'm not attached to the placement of the signup, and you can choose to include it wherever you want with `{% include scripts/newsletter.liquid %}`. Also if you include positional variables into that, you can choose how you center the signup. So `{% include scripts/newsletter.liquid left=true %}` positions the signup bar to the left. Here are some screenshots below: ## Dark version ![image](https://github.com/alshedivat/al-folio/assets/52665298/af7fdb81-6e5f-47a9-958b-4cb93bba9e8f) ## Light version ![image](https://github.com/alshedivat/al-folio/assets/52665298/927f8bc5-b481-448b-ae5e-6f5b1c613243) I think the input field color should probably change to maybe be light for both themes? What do you think? I think the dark background looks cool, but I don't usually see that done like that on other sites. ## Footer fixed ![image](https://github.com/alshedivat/al-folio/assets/52665298/c52f3dc1-0e45-400e-8b71-eeb00d00cb01) ![image](https://github.com/alshedivat/al-folio/assets/52665298/678a2d45-88ab-4d9a-b8cc-9fc6db26d744) ## Footer not fixed ![image](https://github.com/alshedivat/al-folio/assets/52665298/fd2c0228-2bce-4335-ac3c-5cb20a3307e2) ![image](https://github.com/alshedivat/al-folio/assets/52665298/f594b4f2-67e0-4f2b-a3e8-febd579aaf19) To clarify, if footer isn't fixed, the email signup will appear on every page. --------- Co-authored-by: George <31376482+george-gca@users.noreply.github.com> --- _config.yml | 9 ++ _includes/footer.liquid | 4 + _includes/related_posts.liquid | 4 + _includes/scripts/newsletter.liquid | 176 ++++++++++++++++++++++++++++ _layouts/about.liquid | 4 + _sass/_base.scss | 119 +++++++++++++++++++ _sass/_themes.scss | 4 + 7 files changed, 320 insertions(+) create mode 100644 _includes/scripts/newsletter.liquid diff --git a/_config.yml b/_config.yml index edc4027441ae..a6efd6583f78 100644 --- a/_config.yml +++ b/_config.yml @@ -174,6 +174,15 @@ external_sources: - url: https://blog.google/technology/ai/google-gemini-update-flash-ai-assistant-io-2024/ published_date: 2024-05-14 +# ----------------------------------------------------------------------------- +# Newsletter +# ----------------------------------------------------------------------------- + +newsletter: + enabled: false + endpoint: # your loops endpoint (e.g., https://app.loops.so/api/newsletter-form/YOUR-ENDPOINT) + # https://loops.so/docs/forms/custom-form + # ----------------------------------------------------------------------------- # Collections # ----------------------------------------------------------------------------- diff --git a/_includes/footer.liquid b/_includes/footer.liquid index 7541c96ca834..feecc1bb0f7b 100644 --- a/_includes/footer.liquid +++ b/_includes/footer.liquid @@ -15,6 +15,10 @@ {% else %}