✨ customizable newsletter
This commit is contained in:
@@ -257,6 +257,7 @@ Global configuration in `comics_data.py`:
|
||||
- `USE_HEADER_NAV_ICONS`: Set to True to display icons next to main header navigation text (uses alert.png, archive.png, info.png)
|
||||
- `USE_FOOTER_SOCIAL_ICONS`: Set to True to use icons instead of text for footer social links (uses instagram.png, youtube.png, mail.png, alert.png)
|
||||
- `NEWSLETTER_ENABLED`: Set to True to show newsletter section in footer
|
||||
- `NEWSLETTER_HTML`: Custom HTML for newsletter form (user pastes their service's form code here)
|
||||
- `SOCIAL_INSTAGRAM`: Instagram URL (set to None to hide)
|
||||
- `SOCIAL_YOUTUBE`: YouTube URL (set to None to hide)
|
||||
- `SOCIAL_EMAIL`: Email mailto link (set to None to hide)
|
||||
@@ -318,6 +319,7 @@ Global context variables injected into all templates:
|
||||
- `use_header_nav_icons`: Boolean for main header navigation icons from `comics_data.py`
|
||||
- `use_footer_social_icons`: Boolean for footer social link icons from `comics_data.py`
|
||||
- `newsletter_enabled`: Boolean to show/hide newsletter section from `comics_data.py`
|
||||
- `newsletter_html`: Custom HTML for newsletter form from `comics_data.py` (rendered with `| safe` filter)
|
||||
- `social_instagram`: Instagram URL from `comics_data.py`
|
||||
- `social_youtube`: YouTube URL from `comics_data.py`
|
||||
- `social_email`: Email link from `comics_data.py`
|
||||
|
||||
4
app.py
4
app.py
@@ -9,7 +9,8 @@ from flask import Flask, render_template, abort, jsonify, request
|
||||
from comics_data import (
|
||||
COMICS, COMIC_NAME, COPYRIGHT_NAME, SITE_URL, CDN_URL, FULL_WIDTH_DEFAULT, PLAIN_DEFAULT, LOGO_IMAGE, LOGO_MODE,
|
||||
HEADER_IMAGE, FOOTER_IMAGE, BANNER_IMAGE, COMPACT_FOOTER, ARCHIVE_FULL_WIDTH, SECTIONS_ENABLED,
|
||||
USE_COMIC_NAV_ICONS, USE_HEADER_NAV_ICONS, USE_FOOTER_SOCIAL_ICONS, USE_SHARE_ICONS, NEWSLETTER_ENABLED,
|
||||
USE_COMIC_NAV_ICONS, USE_HEADER_NAV_ICONS, USE_FOOTER_SOCIAL_ICONS, USE_SHARE_ICONS,
|
||||
NEWSLETTER_ENABLED, NEWSLETTER_HTML,
|
||||
SOCIAL_INSTAGRAM, SOCIAL_YOUTUBE, SOCIAL_EMAIL, API_SPEC_LINK, EMBED_ENABLED, PERMALINK_ENABLED
|
||||
)
|
||||
import markdown
|
||||
@@ -72,6 +73,7 @@ def inject_global_settings():
|
||||
'use_footer_social_icons': USE_FOOTER_SOCIAL_ICONS,
|
||||
'use_share_icons': USE_SHARE_ICONS,
|
||||
'newsletter_enabled': NEWSLETTER_ENABLED,
|
||||
'newsletter_html': NEWSLETTER_HTML,
|
||||
'social_instagram': SOCIAL_INSTAGRAM,
|
||||
'social_youtube': SOCIAL_YOUTUBE,
|
||||
'social_email': SOCIAL_EMAIL,
|
||||
|
||||
@@ -86,6 +86,17 @@ USE_SHARE_ICONS = True
|
||||
# Global setting: Set to True to show newsletter section in footer
|
||||
NEWSLETTER_ENABLED = False
|
||||
|
||||
# Global setting: Custom HTML for newsletter form (only used if NEWSLETTER_ENABLED is True)
|
||||
# Paste your newsletter service's form HTML here (Mailchimp, ConvertKit, Buttondown, etc.)
|
||||
# Example:
|
||||
# NEWSLETTER_HTML = '''
|
||||
# <form action="https://yourservice.com/subscribe" method="post" class="newsletter-form">
|
||||
# <input type="email" name="email" placeholder="Enter your email" required>
|
||||
# <button type="submit">Subscribe</button>
|
||||
# </form>
|
||||
# '''
|
||||
NEWSLETTER_HTML = '<p class="newsletter-placeholder">Newsletter coming soon!</p>'
|
||||
|
||||
# Social media links - set to None to hide the link
|
||||
SOCIAL_INSTAGRAM = None # e.g., 'https://instagram.com/yourhandle'
|
||||
SOCIAL_YOUTUBE = None # e.g., 'https://youtube.com/@yourchannel'
|
||||
|
||||
@@ -86,6 +86,17 @@ USE_SHARE_ICONS = True
|
||||
# Global setting: Set to True to show newsletter section in footer
|
||||
NEWSLETTER_ENABLED = False
|
||||
|
||||
# Global setting: Custom HTML for newsletter form (only used if NEWSLETTER_ENABLED is True)
|
||||
# Paste your newsletter service's form HTML here (Mailchimp, ConvertKit, Buttondown, etc.)
|
||||
# Example:
|
||||
# NEWSLETTER_HTML = '''
|
||||
# <form action="https://yourservice.com/subscribe" method="post" class="newsletter-form">
|
||||
# <input type="email" name="email" placeholder="Enter your email" required>
|
||||
# <button type="submit">Subscribe</button>
|
||||
# </form>
|
||||
# '''
|
||||
NEWSLETTER_HTML = '<p class="newsletter-placeholder">Newsletter coming soon!</p>'
|
||||
|
||||
# Social media links - set to None to hide the link
|
||||
SOCIAL_INSTAGRAM = None # e.g., 'https://instagram.com/yourhandle'
|
||||
SOCIAL_YOUTUBE = None # e.g., 'https://youtube.com/@yourchannel'
|
||||
|
||||
@@ -146,12 +146,7 @@
|
||||
{% if newsletter_enabled %}
|
||||
<div class="footer-section">
|
||||
<h3>Newsletter</h3>
|
||||
<!-- Replace with your newsletter service form -->
|
||||
<!-- <form class="newsletter-form" action="#" method="post">
|
||||
<input type="email" name="email" placeholder="Enter your email" required>
|
||||
<button type="submit">Subscribe</button>
|
||||
</form> -->
|
||||
<p class="newsletter-placeholder">Newsletter coming soon!</p>
|
||||
{{ newsletter_html | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user