summaryrefslogtreecommitdiffstats
path: root/docs/manual/ablog-configuration-options.rst
blob: 9b25fb3bfec7f2dbfb7e4b6555520167a3c08ebd (plain)
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
.. _config:

ABlog Configuration Options
===========================

.. post:: May 10, 2014
   :tags: config
   :author: Ahmet
   :category: Manual
   :location: Pittsburgh


This post describes ABlog configuration options that go in :ref:`Sphinx build configuration file <sphinx:build-config>`.

General options
---------------

.. confval:: blog_path

   A path relative to the configuration directory for blog archive pages.
   Default is ``'blog'``.

Authors, languages, & locations
-------------------------------

.. confval:: blog_authors

   A dictionary of author names mapping to author full display names and links.
   Dictionary keys are what should be used in ``post`` directive to refer to the author.
   Default is ``{}``.
   Example::

     blog_authors = {
         'Ahmet': ('Ahmet Bakan', 'http://ahmetbakan.com'),
         'Durden': ('Tyler Durden',
                    'https://en.wikipedia.org/wiki/Tyler_Durden'),
     }

.. confval:: blog_default_author

   Name of the default author defined in :confval:`blog_authors`.
   Default is ``None``.

.. confval:: blog_languages

   A dictionary of language code names mapping to full display names and links of these languages.
   Similar to :confval:`blog_authors`, dictionary keys should be used in ``post`` directive to refer to the locations.
   Default is ``{}``.
   Example::

     blog_languages = {
         'en': ('English', None),
     }

.. confval:: blog_default_language

   Code name of the default language defined in :confval:`blog_languages`.
   Default is ``None``.

.. confval:: blog_locations

   A dictionary of location names mapping to full display names and links of these locations.
   Similar to :confval:`blog_authors`, dictionary keys should be used in ``post`` directive to refer to the locations.
   Default is ``{}``.

.. confval:: blog_default_location

   Name of the default location defined in :confval:`blog_locations`.
   Default is ``None``.

.. update:: Sep 15, 2014

   Added :confval:`blog_languages` and :confval:`blog_default_language` configuration variables.

Post related
------------

.. confval:: post_date_format

   Date display format (default is ``'%b %d, %Y'``, e.g., ``12 August 2024``) for published posts that goes as input to :meth:`datetime.date.strftime`.

.. confval:: post_date_format_short

   Date display format in recent posts sidebar (default is ``'%d %B'``, e.g., ``12 October``) for published posts that goes as input to :meth:`datetime.date.strftime`.

.. confval:: post_auto_excerpt

   Number of paragraphs (default is ``1``) that will be displayed as an excerpt from the post.
   Setting this ``0`` will result in displaying no post excerpt in archive pages.
   This option can be set on a per post basis using :rst:dir:`post` directive option ``excerpt``.

   See :ref:`post-excerpts-and-images` for a more detailed discussion.

.. confval:: post_auto_image

   Index of the image that will be displayed in the excerpt of the post.
   Default is ``0``, meaning no image.
   Setting this to ``1`` will include the first image, when available, to the excerpt.
   This option can be set on a per post basis using :rst:dir:`post` directive option ``image``.

.. confval:: post_redirect_refresh

   Number of seconds (default is ``5``) that a redirect page waits before refreshing the page to redirect to the post.

.. confval:: post_always_section

   When ``True``, post title and excerpt is always taken from the section that contains the :rst:dir:`post` directive, instead of the document.
   This is the behavior when :rst:dir:`post` is used multiple times in a document.
   Default is ``False``.

.. confval:: post_show_prev_next

    When ``True``, links to the previous and next posts will be rendered at the bottom of the page.
    Default is ``True``

Blog feeds
----------

Turn feeds on by setting :confval:`blog_baseurl` configuration variable.

.. confval:: blog_baseurl

   Base URL for the website, turns on generating feeds. E.g., ``https://ablog.readthedocs.io``.

Then optionally set the following:

.. confval:: blog_title

   The “title” for the blog, used in feeds title (not archive web pages title).  Default is ``'Blog'``.

.. confval:: blog_archive_titles

   Choose to archive only post titles in collection pages, default is ``False``.

.. confval:: blog_feed_archives

   Choose to create feeds per author, location, tag, category, and year, default is ``False``.

.. confval:: blog_feed_fulltext

   Choose to display full text in blog feeds, default is ``False``.

.. confval:: blog_feed_subtitle

   Blog feed subtitle, default is ``None``.

.. confval:: blog_feed_titles

   Choose to feed only post titles, default is ``False``.

.. confval:: blog_feed_templates

   A dictionary of feed filename roots mapping to nested dictionaries of feed entry
   elements, ``title``, ``summary``, and/or ``content``, and a `Jinja2`_ template which will be
   used to render the value used for that element in that feed.  Templates are rendered
   with the the following context:
   - ``feed_length``
   - ``feed_fulltext``
   - ``feed_posts``
   - ``pagename``
   - ``feed_title``
   - ``feed_url``
   - ``feed``
   - ``post``
   - ``post_url``
   - ``content``
   - ``feed_entry``
   - ``title``
   - ``summary``
   - ``blog``
   - ``url``
   - ``app``
   Default is: ``{"atom": {}}``
   Example to add an additional feed for posting to social media::

      blog_feed_templates = {
            # Use defaults, no templates
            "atom": {},
            # Create content text suitable posting to social media
            "social": {
               # Format tags as hashtags and append to the content
               "content": "{{ title }}{% for tag in post.tags %}"
               " #{{ tag.name|trim()|replace(' ', '') }}"
               "{% endfor %}",
            },
      }

.. confval:: blog_feed_length

   Specify number of recent posts to include in feeds, default is ``None`` for all posts.

.. update:: Aug 24, 2014

   Added :confval:`blog_feed_archives`, :confval:`blog_feed_fulltext`, :confval:`blog_feed_subtitle`, and :confval:`post_always_section` options.

.. update:: Nov 27, 2014

   Added :confval:`blog_feed_titles`, :confval:`blog_feed_length`, and :confval:`blog_archive_titles` options.

.. update:: Mar 20, 2021

   Added :confval:`blog_feed_templates` option.

.. _fa:
.. _Jinja2: https://jinja.palletsprojects.com/

.. _font-awesome:

Font awesome
------------

ABlog templates will use of `Font Awesome`_ icons if one of the following is set:

.. _Font Awesome: https://fontawesome.com/

.. confval:: fontawesome_link_cdn

   URL to `Font Awesome`_ :file:`.css` hosted at `Bootstrap CDN`_ or anywhere else.
   Default: ``None``

   .. _Bootstrap CDN: https://www.bootstrapcdn.com/fontawesome/

.. update:: Jul 29, 2015

   :confval:`fontawesome_link_cdn` was a *boolean* option, and now became a *string* to enable using desired version of `Font Awesome`_.
   To get the old behavior, use ``‘https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css'``.

.. confval:: fontawesome_included

   Sphinx_ theme already links to `Font Awesome`_.
   Default: ``False``

Alternatively, you can provide the path to `Font Awesome`_ :file:`.css` with the following configuration option:

.. confval:: fontawesome_css_file

   Path to `Font Awesome`_ :file:`.css` (default is ``None``) that will be linked to in HTML output by ABlog.

.. _disqus-integration:

Disqus integration
------------------

Of course one cannot think of a blog that doesn't allow for visitors to comment.
You can enable Disqus_ by setting :confval:`disqus_shortname` and :confval:`blog_baseurl` variables.
The reason for requiring :confval:`blog_baseurl` to be specified as of v0.7.2 is to ensure that Disqus associates correct URLs with threads when you serve new posts locally for the first time.

.. confval:: disqus_shortname

   Disqus_ short name for the website.

.. confval:: disqus_pages

   Choose to disqus pages that are not posts, default is ``False``.

.. confval:: disqus_drafts

   Choose to disqus posts that are drafts (without a published date), default is ``False``.

Isso integration
----------------

An alternative to Disqus, is `Isso <https://isso-comments.de/>`__.
Integration is provided by `sphinxnotes-isso`_ and the instructions there.

.. _sphinxnotes-isso: https://sphinx-notes.github.io/isso/

Command Options
---------------

.. update:: Apr 7, 2015

   Added :ref:`commands` options.

.. confval:: ablog_website

   Directory name for build output files. Default is ``_website``.

.. confval:: ablog_doctrees

   Directory name for build cache files. Default is ``.doctrees``.

.. confval:: ablog_builder

   HTML builder, default is ``dirhtml``. Build HTML pages, but with a single directory per document.
   Makes for prettier URLs (no .html) if served from a webserver. Alternative is ``html`` to build one HTML file per document.

.. confval:: github_pages

   GitHub user name used by ``ablog deploy`` command.
   See :ref:`deploy` and :ref:`deploy-to-github-pages` for more information.