mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge branch 'master' into use-https-links
This commit is contained in:
commit
9affc4e218
4 changed files with 29 additions and 14 deletions
|
|
@ -140,6 +140,10 @@ Install the needed dependencies and set up the project::
|
||||||
|
|
||||||
invoke setup
|
invoke setup
|
||||||
|
|
||||||
|
Create a topic branch for your plugin bug fix or feature::
|
||||||
|
|
||||||
|
git checkout -b name-of-your-bugfix-or-feature
|
||||||
|
|
||||||
After writing new tests for your plugin changes, run the plugin test suite::
|
After writing new tests for your plugin changes, run the plugin test suite::
|
||||||
|
|
||||||
invoke tests
|
invoke tests
|
||||||
|
|
|
||||||
|
|
@ -362,16 +362,15 @@ variables allow you to place your articles in a location such as
|
||||||
example below). These settings give you the flexibility to place your articles
|
example below). These settings give you the flexibility to place your articles
|
||||||
and pages anywhere you want.
|
and pages anywhere you want.
|
||||||
|
|
||||||
.. note::
|
If you don't want that flexibility and instead prefer that your generated
|
||||||
If you specify a ``datetime`` directive, it will be substituted using the
|
output paths mirror your source content's filesystem path hierarchy, try the
|
||||||
input files' date metadata attribute. If the date is not specified for a
|
following settings::
|
||||||
particular file, Pelican will rely on the file's ``mtime`` timestamp. Check
|
|
||||||
the `Python datetime documentation`_ for more information.
|
|
||||||
|
|
||||||
.. _Python datetime documentation:
|
PATH_METADATA = '(?P<path_no_ext>.*)\..*'
|
||||||
https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior
|
ARTICLE_URL = ARTICLE_SAVE_AS = PAGE_URL = PAGE_SAVE_AS = '{path_no_ext}.html'
|
||||||
|
|
||||||
Also, you can use other file metadata attributes as well:
|
Otherwise, you can use a variety of file metadata attributes within URL-related
|
||||||
|
settings:
|
||||||
|
|
||||||
* slug
|
* slug
|
||||||
* date
|
* date
|
||||||
|
|
@ -391,6 +390,15 @@ This would save your articles into something like
|
||||||
``/pages/about/index.html``, and render them available at URLs of
|
``/pages/about/index.html``, and render them available at URLs of
|
||||||
``/posts/2011/Aug/07/sample-post/`` and ``/pages/about/``, respectively.
|
``/posts/2011/Aug/07/sample-post/`` and ``/pages/about/``, respectively.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
If you specify a ``datetime`` directive, it will be substituted using the
|
||||||
|
input files' date metadata attribute. If the date is not specified for a
|
||||||
|
particular file, Pelican will rely on the file's ``mtime`` timestamp. Check
|
||||||
|
the `Python datetime documentation`_ for more information.
|
||||||
|
|
||||||
|
.. _Python datetime documentation:
|
||||||
|
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
|
||||||
|
|
||||||
.. data:: RELATIVE_URLS = False
|
.. data:: RELATIVE_URLS = False
|
||||||
|
|
||||||
Defines whether Pelican should use document-relative URLs or not. Only set
|
Defines whether Pelican should use document-relative URLs or not. Only set
|
||||||
|
|
@ -645,7 +653,7 @@ Time and Date
|
||||||
the language name (``lang`` metadata in your post content) as the key.
|
the language name (``lang`` metadata in your post content) as the key.
|
||||||
|
|
||||||
In addition to the standard C89 strftime format codes that are listed in
|
In addition to the standard C89 strftime format codes that are listed in
|
||||||
`Python strftime documentation`_, you can use the ``-`` character between
|
`Python datetime documentation`_, you can use the ``-`` character between
|
||||||
``%`` and the format character to remove any leading zeros. For example,
|
``%`` and the format character to remove any leading zeros. For example,
|
||||||
``%d/%m/%Y`` will output ``01/01/2014`` whereas ``%-d/%-m/%Y`` will result
|
``%d/%m/%Y`` will output ``01/01/2014`` whereas ``%-d/%-m/%Y`` will result
|
||||||
in ``1/1/2014``.
|
in ``1/1/2014``.
|
||||||
|
|
@ -696,8 +704,6 @@ Time and Date
|
||||||
|
|
||||||
.. [#] Default is the system locale.
|
.. [#] Default is the system locale.
|
||||||
|
|
||||||
.. _Python strftime documentation: https://docs.python.org/library/datetime.html#strftime-strptime-behavior
|
|
||||||
|
|
||||||
.. _locales on Windows: https://www.microsoft.com/en-us/download/details.aspx?id=55979
|
.. _locales on Windows: https://www.microsoft.com/en-us/download/details.aspx?id=55979
|
||||||
|
|
||||||
.. _locale(1): https://linux.die.net/man/1/locale
|
.. _locale(1): https://linux.die.net/man/1/locale
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,8 @@ your date according to the locale given in your settings::
|
||||||
|
|
||||||
{{ article.date|strftime('%d %B %Y') }}
|
{{ article.date|strftime('%d %B %Y') }}
|
||||||
|
|
||||||
.. _datetime: https://docs.python.org/2/library/datetime.html#datetime-objects
|
.. _datetime: https://docs.python.org/3/library/datetime.html#datetime-objects
|
||||||
.. _strftime: https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior
|
.. _strftime: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
|
||||||
|
|
||||||
|
|
||||||
index.html
|
index.html
|
||||||
|
|
|
||||||
|
|
@ -466,14 +466,19 @@ def listen(server, port, output, excqueue=None):
|
||||||
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
|
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
|
||||||
return
|
return
|
||||||
|
|
||||||
logging.info("Serving at port %s, server %s.", port, server)
|
|
||||||
try:
|
try:
|
||||||
|
print("\nServing site at: {}:{} - Tap CTRL-C to stop".format(
|
||||||
|
server, port))
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if excqueue is not None:
|
if excqueue is not None:
|
||||||
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
|
excqueue.put(traceback.format_exception_only(type(e), e)[-1])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("\nKeyboard interrupt received. Shutting down server.")
|
||||||
|
httpd.socket.close()
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
args = parse_arguments(argv)
|
args = parse_arguments(argv)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue