diff --git a/documentation/content/Mailing List/freelists.md b/documentation/content/Mailing List/freelists.md index 5240aa89..559aeb1e 100644 --- a/documentation/content/Mailing List/freelists.md +++ b/documentation/content/Mailing List/freelists.md @@ -1,12 +1,12 @@ --- Title: Add FreeLists Tags: marketing, network, subscriber -layout: post Date: 2018-07-05 23:20 comments: false Slug: add-freelists Category: Mailing List authors: Talha Mansoor +freelists_filter: off --- Elegant shows a form to subscribe to your newsletter, above the fold, in the right section of every article. @@ -18,3 +18,39 @@ To customize user experience you can also define, 1. `EMAIL_SUBSCRIPTION_LABEL`, 1. `EMAIL_FIELD_PLACEHOLDER` and 1. `SUBSCRIBE_BUTTON_TITLE` + +## Show FreeLists Form by default + +Just set `FREELISTS_NAME` variable. + +## Hide FreeLists Form by default + +Unset `FREELISTS_NAME` variable. + +This is the default setting. + +## Hide FreeLists Form by default. Show on Selected + +1. Set `FREELISTS_NAME` +1. Set `FREELISTS_FILTER` to `True` + +This will hide FreeLists form on all pages. + +Now to show FreeLists form on selected posts, in article metadata set + +```yaml +freelists_filter: off +``` + +## Show FreeLists Form by default. Hide on Selected + +1. Set `FREELISTS_NAME` +1. Remove `FREELISTS_FILTER` or set it to `False` which is its default value + +This will hide FreeLists form on all pages. + +Now to hide FreeLists form on selected posts, in article metadata set + +```yaml +freelists_filter: on +``` diff --git a/documentation/pelicanconf.py b/documentation/pelicanconf.py index fbf7d4ec..a0d8046c 100644 --- a/documentation/pelicanconf.py +++ b/documentation/pelicanconf.py @@ -177,3 +177,6 @@ "blurb": "FOSS lawyer by trade, hacker by heart.", }, } + +FREELISTS_NAME = "elegant-demo-list" +FREELISTS_FILTER = True diff --git a/templates/_includes/_defaults.html b/templates/_includes/_defaults.html index 740a1ef5..edbd91c7 100644 --- a/templates/_includes/_defaults.html +++ b/templates/_includes/_defaults.html @@ -103,6 +103,12 @@ {% set FREELISTS_NAME = FREELISTS_NAME %} {% endif %} +{% if not FREELISTS_FILTER %} +{% set FREELISTS_FILTER = False %} +{% else %} +{% set FREELISTS_FILTER = FREELISTS_FILTER %} +{% endif %} + {# It is displayed along with the SITENAME in the footer of every page #} {% if not SITESUBTITLE %} {% set SITESUBTITLE = '' %} diff --git a/templates/_includes/freelists.html b/templates/_includes/freelists.html index 538be3db..f3cb88e0 100644 --- a/templates/_includes/freelists.html +++ b/templates/_includes/freelists.html @@ -1,5 +1,12 @@ +{% macro freelists(article) %} + {% from '_includes/_defaults.html' import FREELISTS_NAME with context %} +{% from '_includes/_defaults.html' import FREELISTS_FILTER with context %} + +{%if (not FREELISTS_FILTER or article.freelists_filter == "off") and article.freelists_filter != "on" %} + {% if FREELISTS_NAME %} + {% from '_includes/_defaults.html' import EMAIL_SUBSCRIPTION_LABEL with context %} {% from '_includes/_defaults.html' import SUBSCRIBE_BUTTON_TITLE with context %}
@@ -11,3 +18,7 @@

{{ EMAIL_SUBSCRIPTION_LABEL }}

{% endif %} + +{% endif %} + +{% endmacro %} diff --git a/templates/article.html b/templates/article.html index 2885b859..60db648b 100644 --- a/templates/article.html +++ b/templates/article.html @@ -135,7 +135,8 @@

Tags

{% endif %} {% include '_includes/social_links.html' %} {% include '_includes/mailchimp.html' %} - {% include '_includes/freelists.html' %} + {% from '_includes/freelists.html' import freelists with context %} + {{ freelists(article) }}