Skip to content

Only use search plugins for website styling #4077

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

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
17 changes: 12 additions & 5 deletions pelicanconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
from __future__ import unicode_literals
import os

# Adjust `TESTING_LOCALLY` if testing search functionality locally.
TESTING_LOCALLY = False
USE_EMAIL_THEME = True if os.environ.get('USE_EMAIL_THEME') == '1' else False

AUTHOR = u'TWiR Contributors'
SITENAME = u"This Week in Rust"
SITEURL = 'https://this-week-in-rust.org'
SITEURL = 'https://this-week-in-rust.org' if not TESTING_LOCALLY else 'http://localhost:8000'

SOURCE_URL = 'https://github.com/rust-lang/this-week-in-rust'

if '1' == os.environ.get('TWIR_NEWSLETTER_THEME'):
if USE_EMAIL_THEME:
THEME = 'themes/newsletter'
else:
THEME = 'themes/rusted'
Expand Down Expand Up @@ -48,9 +52,12 @@
"""
}

SEARCH_HTML_SELECTOR = "article"

PLUGINS = ['webassets', 'search']
# Don't add search functionality for email.
if USE_EMAIL_THEME:
PLUGINS = ['webassets']
else:
PLUGINS = ['webassets', 'search']
SEARCH_HTML_SELECTOR = "article"

MARKDOWN = {
'extension_configs': {
Expand Down
6 changes: 3 additions & 3 deletions publishing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# 2. This workflow will generate the desired email template, landing
# the end contents in the local "output/" directory. This is the
# equivalent of running `TWIR_NEWSLETTER_THEME=1 pelican --delete-output-directory content`
# equivalent of running `USE_EMAIL_THEME=1 pelican --delete-output-directory content`
# from a properly instantantiated environment.
#
# $ make build && make generate-email && make host-content
Expand All @@ -38,7 +38,7 @@
# TODO: The BLOG_DOWNLOAD is only needed because one dockerfile will have to communicate
# with another, and I don't want to deal with building out the networking logic... yet...
# CHANGE ME! vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
BLOG_DOWNLOAD=http://127.0.0.1:8000/blog/2023/01/25/this-week-in-rust-479/
BLOG_DOWNLOAD=http://127.0.0.1:8000/blog/2022/11/16/this-week-in-rust-469/

website-workflow: build clean generate-website host-content

Expand All @@ -58,7 +58,7 @@ generate-website: clean

generate-email: clean
docker run -it \
-e TWIR_NEWSLETTER_THEME=1 \
-e USE_EMAIL_THEME=1 \
-v $(shell pwd)/output:/usr/twir/output \
twir:latest

Expand Down