8000 feat(filter): add black list, white list feature for FreeLists · Pelican-Elegant/elegant@2407cc8 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 2407cc8

Browse files
committed
feat(filter): add black list, white list feature for FreeLists
1 parent 6bc5ff0 commit 2407cc8

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

documentation/content/Mailing List/freelists.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
Title: Add FreeLists
33
Tags: marketing, network, subscriber
4-
layout: post
54
Date: 2018-07-05 23:20
65
comments: false
76
Slug: add-freelists
87
Category: Mailing List
98
authors: Talha Mansoor
9+
freelists_filter: off
1010
---
1111

1212
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,
1818
1. `EMAIL_SUBSCRIPTION_LABEL`,
1919
1. `EMAIL_FIELD_PLACEHOLDER` and
2020
1. `SUBSCRIBE_BUTTON_TITLE`
21+
22+
## Show FreeLists Form by default
23+
24+
Just set `FREELISTS_NAME` variable.
25+
26+
## Hide FreeLists Form by default
27+
28+
Unset `FREELISTS_NAME` variable.
29+
30+
This is the default setting.
31+
32+
## Hide FreeLists Form by default. Show on Selected
33+
34+
1. Set `FREELISTS_NAME`
35+
1. Set `FREELISTS_FILTER` to `True`
36+
37+
This will hide FreeLists form on all pages.
38+
39+
Now to show FreeLists form on selected posts, in article metadata set
40+
41+
```yaml
42+
freelists_filter: off
43+
```
44+
45+
## Show FreeLists Form by default. Hide on Selected
46+
47+
1. Set `FREELISTS_NAME`
48+
1. Remove `FREELISTS_FILTER` or set it to `False` which is its default value
49+
50+
This will hide FreeLists form on all pages.
51+
52+
Now to hide FreeLists form on selected posts, in article metadata set
53+
54+
```yaml
55+
freelists_filter: on
56+
```

documentation/pelicanconf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,6 @@
177177
"blurb": "FOSS lawyer by trade, hacker by heart.",
178178
},
179179
}
180+
181+
FREELISTS_NAME = "elegant-demo-list"
182+
FREELISTS_FILTER = True

templates/_includes/_defaults.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@
103103
{% set FREELISTS_NAME = FREELISTS_NAME %}
104104
{% endif %}
105105

106+
{% if not FREELISTS_FILTER %}
107+
{% set FREELISTS_FILTER = False %}
108+
{% else %}
109+
{% set FREELISTS_FILTER = FREELISTS_FILTER %}
110+
{% endif %}
111+
106112
{# It is displayed along with the SITENAME in the footer of every page #}
107113
{% if not SITESUBTITLE %}
108114
{% set SITESUBTITLE = '' %}

templates/_includes/freelists.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
{% macro freelists(article) %}
2+
13
{% from '_includes/_defaults.html' import FREELISTS_NAME with context %}
4+
{% from '_includes/_defaults.html' import FREELISTS_FILTER with context %}
5+
6+
{%if (not FREELISTS_FILTER or article.freelists_filter == "off") and article.freelists_filter != "on" %}
7+
28
{% if FREELISTS_NAME %}
9+
310
{% from '_includes/_defaults.html' import EMAIL_SUBSCRIPTION_LABEL with context %}
411
{% from '_includes/_defaults.html' import SUBSCRIBE_BUTTON_TITLE with context %}
512
<div id="mc-embed-signup">
@@ -11,3 +18,7 @@ <h4>{{ EMAIL_SUBSCRIPTION_LABEL }}</h4>
1118
<!-- END FreeLists WEB FORM -->
1219
</div>
1320
{% endif %}
21+
22+
{% endif %}
23+
24+
{% endmacro %}

templates/article.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ <h4>Tags</h4>
135135
{% endif %}
136136
{% include '_includes/social_links.html' %}
137137
{% include '_includes/mailchimp.html' %}
138-
{% include '_includes/freelists.html' %}
138+
{% from '_includes/freelists.html' import freelists with context %}
139+
{{ freelists(article) }}
139140
</div>
140141
</section>
141142
</div>

0 commit comments

Comments
 (0)
0