This repository has been archived by the owner on May 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pelicanconf-jenkins-EXAMPLE.py
161 lines (117 loc) · 4.21 KB
/
pelicanconf-jenkins-EXAMPLE.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'BC Libraries'
SITENAME = u'Boston College Libraries'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/New_York'
DEFAULT_LANG = u'en'
THEME = "themes/bc"
CSS_FILE = 'style.css'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
CACHE_CONTENT = True
CONTENT_CACHING_LAYER = 'reader'
LOAD_CONTENT_CACHE = True
USE_FOLDER_AS_CATEGORY = True
ARTICLE_URL = '{category}/{date:%Y}/{date:%b}/{slug}/'
ARTICLE_SAVE_AS = '{category}/{date:%Y}/{date:%b}/{slug}/index.html'
PAGE_URL = '{slug}/'
PAGE_SAVE_AS = '{slug}/index.html'
# Social widget
SOCIAL = (('You can add links in your config file', '#'),
('Another social link', '#'),)
DEFAULT_PAGINATION = 00
# Uncomment following line if you want document-relative URLs when developing
# RELATIVE_URLS = True
PLUGIN_PATHS = ['plugins']
PLUGINS = ['sitemap', ]
SITEMAP = {
'format': 'xml',
'priorities': {
'articles': 0.3,
'indexes': 0.5,
'pages': 0.9
},
'changefreqs': {
'articles': 'monthly',
'indexes': 'daily',
'pages': 'daily'
}
}
WITH_FUTURE_DATES = False
STATIC_PATHS = [
'extra/favicon.ico',
]
# path-specific metadata
EXTRA_PATH_METADATA = {
'extra/favicon.ico': {'path': 'favicon.ico'},
}
DIRECT_TEMPLATES = (('index', 'news/index',
'exhibits/index', 'exhibits/burns/index', 'exhibits/backwall/index', 'exhibits/bapst/index',
'exhibits/lvl1/index',
'exhibits/lvl3/index', 'exhibits/lobby/index', 'exhibits/reading/index', 'exhibits/stokes/index',
'exhibits/tiponeill/index', 'exhibits/tml/index', 'exhibits/virtual/index',
'exhibits/spaces/index',
'facpub/index', 'facpub/contact/index', 'facpub/mailer/index', 'newsletter/index', 'search/index',
'feedback/index'))
# PAGINATED_DIRECT_TEMPLATES = (('index', 'news/index', 'exhibits/index', 'facpub/index', 'facpub/contact/index', 'facpub/mailer/index', 'newsletter/index' ))#
TEMPLATE_PAGES = {
'facpub/index.html': 'facpub/index.html',
'facpub/contact/index.html': 'facpub/contact/index.html'
}
def has_category(articles_list, list):
"""
Filter out articles with categories not in list
ex. articles | has_category(['news','announcements'])
:param articles_list:
:param list:
:return: list:
"""
return [article for article in articles_list if article.category.name in list]
def has_year(articles_list, year):
"""
Filter out articles not from year
ex. articles | has_year('2015')
:param articles_list:
:param year:
:return: list:
"""
return [article for article in articles_list if article.date.strftime('%Y') == year]
def not_oneoff(articles_list):
"""
Filter out articles that are one-offs
ex. articles | not_oneoff
:param articles_list:
:return:
"""
return [article for article in articles_list if not (hasattr(article, 'oneoff')) or article.oneoff != 'yes']
def most_recent_news(articles_list, count):
news_articles = [a for a in articles_list if a.category.name == 'news' and is_not_expired(a)][:count]
for a in news_articles:
if not a.destination:
a.destination = a.url
return news_articles
def current_stories(articles_list, count):
return [a for a in articles_list if a.category.name == 'stories' and is_not_expired(a)][:count]
def current_facpubs(articles_list, count):
return [a for a in articles_list if a.category.name == 'facpub' and is_not_oneoff(a)][:count]
def is_not_expired(article):
return not (hasattr(article, 'expired')) or article.expired != 'yes'
def is_not_oneoff(article):
return not (hasattr(article, 'oneoff')) or article.oneoff == 'no'
# These are filters we can use in templates
JINJA_FILTERS = {
'has_category': has_category,
'has_year': has_year,
'not_oneoff': not_oneoff,
'most_recent_news': most_recent_news,
'current_stories': current_stories,
'current_facpubs': current_facpubs
}
# Custom build variables
LOCAL_BUILD = False
JENKINS_BUILD = True