From f595741b8e7dfd1cf6a59618edae0a465e2ef025 Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Fri, 2 Nov 2018 20:53:15 -0600 Subject: [PATCH] Docs: Reflow to 79 char line limit --- docs/changelog.rst | 21 ++-- docs/content.rst | 48 ++++---- docs/contribute.rst | 15 ++- docs/faq.rst | 117 +++++++++--------- docs/importer.rst | 5 +- docs/index.rst | 8 +- docs/install.rst | 14 +-- docs/internals.rst | 40 +++--- docs/pelican-themes.rst | 38 ++++-- docs/plugins.rst | 31 +++-- docs/publish.rst | 66 +++++----- docs/quickstart.rst | 11 +- docs/report.rst | 117 +++++++++--------- docs/settings.rst | 263 ++++++++++++++++++++-------------------- docs/themes.rst | 89 +++++++------- docs/tips.rst | 40 +++--- 16 files changed, 472 insertions(+), 451 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 858a6e1b..85414a6f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,8 +12,9 @@ Next release ``'bar'`` from ``'foo/bar.html'`` (unless ``'bar' == 'index'``). * ``ARTICLE_ORDER_BY`` and ``PAGE_ORDER_BY`` now also affect 1) category, tag and author pages 2) feeds 3) draft and hidden articles and pages -* New ``ARTICLE_TRANSLATION_ID`` and ``PAGE_TRANSLATION_ID`` settings to specify - metadata attributes used to identify translations; or to disable translations +* New ``ARTICLE_TRANSLATION_ID`` and ``PAGE_TRANSLATION_ID`` settings to + specify metadata attributes used to identify translations; or to disable + translations * New ``{static}`` syntax to link to static content; content linked to by ``{static}`` and ``{attach}`` is automatically copied over even if not in ``STATIC_PATHS`` @@ -103,8 +104,8 @@ Next release directory as articles and pages using ``{attach}`` in the path. * Prevent Pelican from raising an exception when there are duplicate pieces of metadata in a Markdown file. -* Introduce the ``TYPOGRIFY_IGNORE_TAGS`` setting to add HTML tags to be ignored - by Typogrify. +* Introduce the ``TYPOGRIFY_IGNORE_TAGS`` setting to add HTML tags to be + ignored by Typogrify. * Add the ability to use ``-`` in date formats to strip leading zeros. For example, ``%-d/%-m/%y`` will now result in the date ``9/8/12``. * Ensure feed generation is correctly disabled during quickstart configuration. @@ -207,8 +208,10 @@ Next release * Improve appearance of LinkedIn icon in default theme * Add GitHub and Google+ social icons support in default theme * Optimize social icons -* Add ``FEED_ALL_ATOM`` and ``FEED_ALL_RSS`` to generate feeds containing all posts regardless of their language -* Split ``TRANSLATION_FEED`` into ``TRANSLATION_FEED_ATOM`` and ``TRANSLATION_FEED_RSS`` +* Add ``FEED_ALL_ATOM`` and ``FEED_ALL_RSS`` to generate feeds containing all + posts regardless of their language +* Split ``TRANSLATION_FEED`` into ``TRANSLATION_FEED_ATOM`` and + ``TRANSLATION_FEED_RSS`` * Different feeds can now be enabled/disabled individually * Allow for blank author: if ``AUTHOR`` setting is not set, author won't default to ``${USER}`` anymore, and a post won't contain any author @@ -216,7 +219,8 @@ Next release * Move LESS and Webassets support from Pelican core to plugin * The ``DEFAULT_DATE`` setting now defaults to ``None``, which means that articles won't be generated unless date metadata is specified -* Add ``FILENAME_METADATA`` setting to support metadata extraction from filename +* Add ``FILENAME_METADATA`` setting to support metadata extraction from + filename * Add ``gzip_cache`` plugin to compress common text files into a ``.gz`` file within the same directory as the original file, preventing the server (e.g. Nginx) from having to compress files during an HTTP call @@ -287,7 +291,8 @@ Next release * Added translations * Added a way to use cleaner URLs with a rewrite url module (or equivalent) * Added a tag cloud -* Added an autoreloading feature: the blog is automatically regenerated each time a modification is detected +* Added an autoreloading feature: the blog is automatically regenerated each + time a modification is detected * Translate the documentation into French * Import a blog from an RSS feed * Pagination support diff --git a/docs/content.rst b/docs/content.rst index 8d07e390..78fc7993 100644 --- a/docs/content.rst +++ b/docs/content.rst @@ -70,7 +70,9 @@ Metadata syntax for Markdown posts should follow this pattern:: This is the content of my super blog post. -You can also have your own metadata keys (so long as they don't conflict with reserved metadata keywords) for use in your python templates. The following is the list of reserved metadata keywords: +You can also have your own metadata keys (so long as they don't conflict with +reserved metadata keywords) for use in your python templates. The following is +the list of reserved metadata keywords: * `Title` * `Tags` @@ -133,12 +135,13 @@ the W3C's `suggested subset ISO 8601`__. __ `W3C ISO 8601`_ -``modified`` should be last time you updated the article, and defaults to ``date`` if not specified. -Besides you can show ``modified`` in the templates, feed entries in feed readers will be updated automatically -when you set ``modified`` to the current date after you modified your article. +``modified`` should be last time you updated the article, and defaults to +``date`` if not specified. Besides you can show ``modified`` in the templates, +feed entries in feed readers will be updated automatically when you set +``modified`` to the current date after you modified your article. -``authors`` is a comma-separated list of article authors. If there's only one author you -can use ``author`` field. +``authors`` is a comma-separated list of article authors. If there's only one +author you can use ``author`` field. If you do not explicitly specify summary metadata for a given post, the ``SUMMARY_MAX_LENGTH`` setting can be used to specify how many words from the @@ -181,12 +184,12 @@ static files that are explicitly linked to are included (see below). Mixed content in the same directory ----------------------------------- -Starting with Pelican 3.5, static files can safely share a source directory with -page source files, without exposing the page sources in the generated site. -Any such directory must be added to both ``STATIC_PATHS`` and ``PAGE_PATHS`` -(or ``STATIC_PATHS`` and ``ARTICLE_PATHS``). Pelican will identify and process -the page source files normally, and copy the remaining files as if they lived -in a separate directory reserved for static files. +Starting with Pelican 3.5, static files can safely share a source directory +with page source files, without exposing the page sources in the generated +site. Any such directory must be added to both ``STATIC_PATHS`` and +``PAGE_PATHS`` (or ``STATIC_PATHS`` and ``ARTICLE_PATHS``). Pelican will +identify and process the page source files normally, and copy the remaining +files as if they lived in a separate directory reserved for static files. Note: Placing static and content source files together in the same source directory does not guarantee that they will end up in the same place in the @@ -273,8 +276,8 @@ Site generation would then copy ``han.jpg`` to ``output/images/han.jpg``, ``menu.pdf`` to ``output/pdfs/menu.pdf``, and write the appropriate links in ``test.md``. -If you use ``{static}`` to link to an article or a page, this will be turned into -a link to its source code. +If you use ``{static}`` to link to an article or a page, this will be turned +into a link to its source code. Attaching static files ---------------------- @@ -360,13 +363,13 @@ You can link to authors, categories, index and tags using the ``{author}name``, Deprecated internal link syntax ------------------------------- -To remain compatible with earlier versions, Pelican still supports vertical bars -(``||``) in addition to curly braces (``{}``) for internal links. For example: -``|filename|an_article.rst``, ``|tag|tagname``, ``|category|foobar``. +To remain compatible with earlier versions, Pelican still supports vertical +bars (``||``) in addition to curly braces (``{}``) for internal links. For +example: ``|filename|an_article.rst``, ``|tag|tagname``, ``|category|foobar``. The syntax was changed from ``||`` to ``{}`` to avoid collision with Markdown -extensions or reST directives. Similarly, Pelican also still supports linking to -static content with ``{filename}``. The syntax was changed to ``{static}`` to allow -linking to both generated articles and pages and their static sources. +extensions or reST directives. Similarly, Pelican also still supports linking +to static content with ``{filename}``. The syntax was changed to ``{static}`` +to allow linking to both generated articles and pages and their static sources. Support for the old syntax may eventually be removed. @@ -546,8 +549,9 @@ before publishing, for example), you can add a ``Status: draft`` attribute to its metadata. That article will then be output to the ``drafts`` folder and not listed on the index page nor on any category or tag page. -If your articles should be automatically published as a draft (to not accidentally -publish an article before it is finished) include the status in the ``DEFAULT_METADATA``:: +If your articles should be automatically published as a draft (to not +accidentally publish an article before it is finished) include the status in +the ``DEFAULT_METADATA``:: DEFAULT_METADATA = { 'status': 'draft', diff --git a/docs/contribute.rst b/docs/contribute.rst index 35e9797d..5a314751 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -66,9 +66,8 @@ Open ``_build/html/index.html`` in your browser to preview the documentation. Running the test suite ====================== -Each time you add a feature, there are two things to do regarding tests: -check that the existing tests pass, and add tests for the new feature -or bugfix. +Each time you add a feature, there are two things to do regarding tests: check +that the existing tests pass, and add tests for the new feature or bugfix. The tests live in ``pelican/tests`` and you can run them using the "discover" feature of ``unittest``:: @@ -92,8 +91,8 @@ functional tests. To do so, **make sure you have both** ``en_EN.utf8`` **and** You may also find that some tests are skipped because some dependency (e.g., Pandoc) is not installed. This does not automatically mean that these tests -have passed; you should at least verify that any skipped tests are not -affected by your changes. +have passed; you should at least verify that any skipped tests are not affected +by your changes. You should run the test suite under each of the supported versions of Python. This is best done by creating a separate Python environment for each version. @@ -178,9 +177,9 @@ Optionally, you can also set ``'limit_args'`` as a tuple of arguments in ``extra`` dict if your generic message needs formatting. Limit is set to ``5``, i.e, first four logs with the same ``'limit_msg'`` are -outputted normally but the fifth one will be logged using -``'limit_msg'`` (and ``'limit_args'`` if present). After the fifth, -corresponding log messages will be ignored. +outputted normally but the fifth one will be logged using ``'limit_msg'`` (and +``'limit_args'`` if present). After the fifth, corresponding log messages will +be ignored. For example, if you want to log missing resources, use the following code:: diff --git a/docs/faq.rst b/docs/faq.rst index efb49f66..d469f386 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -12,10 +12,10 @@ How can I help? =============== There are several ways to help out. First, you can report any Pelican -suggestions or problems you might have via IRC (preferred) or the -`issue tracker `_. If submitting -an issue report, please first check the existing issue list (both open and -closed) in order to avoid submitting a duplicate issue. +suggestions or problems you might have via IRC (preferred) or the `issue +tracker `_. If submitting an +issue report, please first check the existing issue list (both open and closed) +in order to avoid submitting a duplicate issue. If you want to contribute, please fork `the git repository `_, create a new feature branch, make @@ -35,10 +35,10 @@ via the command line. See ``pelican --help`` for more information. Changes to the settings file take no effect =========================================== -When experimenting with different settings (especially the metadata -ones) caching may interfere and the changes may not be visible. In -such cases, ensure that caching is disabled via ``LOAD_CONTENT_CACHE = False`` -or use the ``--ignore-cache`` command-line switch. +When experimenting with different settings (especially the metadata ones) +caching may interfere and the changes may not be visible. In such cases, ensure +that caching is disabled via ``LOAD_CONTENT_CACHE = False`` or use the +``--ignore-cache`` command-line switch. I'm creating my own theme. How do I use Pygments for syntax highlighting? ========================================================================= @@ -70,9 +70,9 @@ I want to use Markdown, but I got an error. If you try to generate Markdown content without first installing the Markdown library, may see a message that says ``No valid files found in content``. Markdown is not a hard dependency for Pelican, so if you have content in -Markdown format, you will need to explicitly install the Markdown library. -You can do so by typing the following command, prepending ``sudo`` if -permissions require it:: +Markdown format, you will need to explicitly install the Markdown library. You +can do so by typing the following command, prepending ``sudo`` if permissions +require it:: pip install markdown @@ -150,9 +150,9 @@ the ``'index'`` direct template. What if I want to disable feed generation? ========================================== -To disable feed generation, all feed settings should be set to ``None``. -All but three feed settings already default to ``None``, so if you want to -disable all feed generation, you only need to specify the following settings:: +To disable feed generation, all feed settings should be set to ``None``. All +but three feed settings already default to ``None``, so if you want to disable +all feed generation, you only need to specify the following settings:: FEED_ALL_ATOM = None CATEGORY_FEED_ATOM = None @@ -167,9 +167,9 @@ I'm getting a warning about feeds generated without SITEURL being set properly ============================================================================== `RSS and Atom feeds require all URL links to be absolute -`_. -In order to properly generate links in Pelican you will need to set ``SITEURL`` -to the full path of your site. +`_. In order to properly +generate links in Pelican you will need to set ``SITEURL`` to the full path of +your site. Feeds are still generated when this warning is displayed, but links within may be malformed and thus the feed may not validate. @@ -185,26 +185,26 @@ setting names). Here is an exact list of the renamed settings:: TAG_FEED -> TAG_FEED_ATOM CATEGORY_FEED -> CATEGORY_FEED_ATOM -Starting in 3.1, the new feed ``FEED_ALL_ATOM`` has been introduced: this -feed will aggregate all posts regardless of their language. This setting -generates ``'feeds/all.atom.xml'`` by default and ``FEED_ATOM`` now defaults to -``None``. The following feed setting has also been renamed:: +Starting in 3.1, the new feed ``FEED_ALL_ATOM`` has been introduced: this feed +will aggregate all posts regardless of their language. This setting generates +``'feeds/all.atom.xml'`` by default and ``FEED_ATOM`` now defaults to ``None``. +The following feed setting has also been renamed:: TRANSLATION_FEED -> TRANSLATION_FEED_ATOM -Older themes that referenced the old setting names may not link properly. -In order to rectify this, please update your theme for compatibility by changing +Older themes that referenced the old setting names may not link properly. In +order to rectify this, please update your theme for compatibility by changing the relevant values in your template files. For an example of complete feed headers and usage please check out the ``simple`` theme. Is Pelican only suitable for blogs? =================================== -No. Pelican can be easily configured to create and maintain any type of static site. -This may require a little customization of your theme and Pelican configuration. -For example, if you are building a launch site for your product and do not need -tags on your site, you could remove the relevant HTML code from your theme. -You can also disable generation of tag-related pages via:: +No. Pelican can be easily configured to create and maintain any type of static +site. This may require a little customization of your theme and Pelican +configuration. For example, if you are building a launch site for your product +and do not need tags on your site, you could remove the relevant HTML code from +your theme. You can also disable generation of tag-related pages via:: TAGS_SAVE_AS = '' TAG_SAVE_AS = '' @@ -212,52 +212,49 @@ You can also disable generation of tag-related pages via:: Why does Pelican always write all HTML files even with content caching enabled? =============================================================================== -In order to reliably determine whether the HTML output is different -before writing it, a large part of the generation environment -including the template contexts, imported plugins, etc. would have to -be saved and compared, at least in the form of a hash (which would -require special handling of unhashable types), because of all the -possible combinations of plugins, pagination, etc. which may change in -many different ways. This would require a lot more processing time -and memory and storage space. Simply writing the files each time is a -lot faster and a lot more reliable. +In order to reliably determine whether the HTML output is different before +writing it, a large part of the generation environment including the template +contexts, imported plugins, etc. would have to be saved and compared, at least +in the form of a hash (which would require special handling of unhashable +types), because of all the possible combinations of plugins, pagination, etc. +which may change in many different ways. This would require a lot more +processing time and memory and storage space. Simply writing the files each +time is a lot faster and a lot more reliable. -However, this means that the modification time of the files changes -every time, so a ``rsync`` based upload will transfer them even if -their content hasn't changed. A simple solution is to make ``rsync`` -use the ``--checksum`` option, which will make it compare the file -checksums in a much faster way than Pelican would. +However, this means that the modification time of the files changes every time, +so a ``rsync`` based upload will transfer them even if their content hasn't +changed. A simple solution is to make ``rsync`` use the ``--checksum`` option, +which will make it compare the file checksums in a much faster way than Pelican +would. -When only several specific output files are of interest (e.g. when -working on some specific page or the theme templates), the -`WRITE_SELECTED` option may help, see -:ref:`writing_only_selected_content`. +When only several specific output files are of interest (e.g. when working on +some specific page or the theme templates), the `WRITE_SELECTED` option may +help, see :ref:`writing_only_selected_content`. How to process only a subset of all articles? ============================================= -It is often useful to process only e.g. 10 articles for debugging -purposes. This can be achieved by explicitly specifying only the -filenames of those articles in ``ARTICLE_PATHS``. A list of such -filenames could be found using a command similar to ``cd content; -find -name '*.md' | head -n 10``. +It is often useful to process only e.g. 10 articles for debugging purposes. +This can be achieved by explicitly specifying only the filenames of those +articles in ``ARTICLE_PATHS``. A list of such filenames could be found using a +command similar to ``cd content; find -name '*.md' | head -n 10``. My tag-cloud is missing/broken since I upgraded Pelican ======================================================= In an ongoing effort to steamline Pelican, `tag_cloud` generation has been moved out of the pelican core and into a separate `plugin -`_. -See the :ref:`plugins` documentation further information about the -Pelican plugin system. +`_. See +the :ref:`plugins` documentation further information about the Pelican plugin +system. Since I upgraded Pelican my pages are no longer rendered ======================================================== -Pages were available to themes as lowercase ``pages`` and uppercase -``PAGES``. To bring this inline with the :ref:`templates-variables` section, -``PAGES`` has been removed. This is quickly resolved by updating your theme -to iterate over ``pages`` instead of ``PAGES``. Just replace:: +Pages were available to themes as lowercase ``pages`` and uppercase ``PAGES``. +To bring this inline with the :ref:`templates-variables` section, ``PAGES`` has +been removed. This is quickly resolved by updating your theme to iterate over +``pages`` instead of ``PAGES``. Just replace:: {% for pg in PAGES %} @@ -271,8 +268,8 @@ How can I stop Pelican from trying to parse my static files as content? Pelican's article and page generators run before it's static generator. That means if you use a setup similar to the default configuration, where a static source directory is defined inside a ``*_PATHS`` setting, all files that have a -valid content file ending (``.html``, ``.rst``, ``.md``, ...) will be treated as -articles or pages before they get treated as static files. +valid content file ending (``.html``, ``.rst``, ``.md``, ...) will be treated +as articles or pages before they get treated as static files. To circumvent this issue either use the appropriate ``*_EXCLUDES`` setting or disable the offending reader via ``READERS`` if you don't need it. diff --git a/docs/importer.rst b/docs/importer.rst index e8614f2a..0f940808 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -26,8 +26,9 @@ Dependencies ``pelican-import`` has some dependencies not required by the rest of Pelican: -- *BeautifulSoup4* and *lxml*, for WordPress and Dotclear import. Can be installed like - any other Python package (``pip install BeautifulSoup4 lxml``). +- *BeautifulSoup4* and *lxml*, for WordPress and Dotclear import. Can be + installed like any other Python package (``pip install BeautifulSoup4 + lxml``). - *Feedparser*, for feed import (``pip install feedparser``). - *Pandoc*, see the `Pandoc site`_ for installation instructions on your operating system. diff --git a/docs/index.rst b/docs/index.rst index ccfb9982..a0084ffb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,14 +6,14 @@ Pelican |release| .. warning:: - This documentation is for the version of Pelican currently under development. - Were you looking for version |last_stable| documentation? + This documentation is for the version of Pelican currently under + development. Were you looking for version |last_stable| documentation? Pelican is a static site generator, written in Python_. Highlights include: -* Write your content directly with your editor of choice - in reStructuredText_ or Markdown_ formats +* Write your content directly with your editor of choice in reStructuredText_ + or Markdown_ formats * Includes a simple CLI tool to (re)generate your site * Easy to interface with distributed version control systems and web hooks * Completely static output is easy to host anywhere diff --git a/docs/install.rst b/docs/install.rst index 09097666..17f275af 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -12,8 +12,8 @@ You can install Pelican via several different methods. The simplest is via (Keep in mind that operating systems will often require you to prefix the above command with ``sudo`` in order to install Pelican system-wide.) -While the above is the simplest method, the recommended approach is to create -a virtual environment for Pelican via virtualenv_ before installing Pelican. +While the above is the simplest method, the recommended approach is to create a +virtual environment for Pelican via virtualenv_ before installing Pelican. Assuming you have virtualenv_ installed, you can then open a new terminal session and create a new virtual environment for Pelican:: @@ -22,9 +22,8 @@ session and create a new virtual environment for Pelican:: source bin/activate Once the virtual environment has been created and activated, Pelican can be -installed via ``pip install pelican`` as noted above. Alternatively, if -you have the project source, you can install Pelican using the distutils -method:: +installed via ``pip install pelican`` as noted above. Alternatively, if you +have the project source, you can install Pelican using the distutils method:: cd path-to-Pelican-source python setup.py install @@ -96,8 +95,9 @@ your site:: pelican-quickstart Once you finish answering all the questions, your project will consist of the -following hierarchy (except for *pages* — shown in parentheses below — which you -can optionally add yourself if you plan to create non-chronological content):: +following hierarchy (except for *pages* — shown in parentheses below — which +you can optionally add yourself if you plan to create non-chronological +content):: yourproject/ ├── content diff --git a/docs/internals.rst b/docs/internals.rst index b267df76..e8d35148 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -1,8 +1,8 @@ Pelican internals ################# -This section describe how Pelican works internally. As you'll see, it's -quite simple, but a bit of documentation doesn't hurt. :) +This section describe how Pelican works internally. As you'll see, it's quite +simple, but a bit of documentation doesn't hurt. :) You can also find in the :doc:`report` section an excerpt of a report the original author wrote with some software design information. @@ -13,9 +13,8 @@ Overall structure ================= What Pelican does is take a list of files and process them into some sort of -output. Usually, the input files are reStructuredText and Markdown -files, and the output is a blog, but both input and output can be anything you -want. +output. Usually, the input files are reStructuredText and Markdown files, and +the output is a blog, but both input and output can be anything you want. The logic is separated into different classes and concepts: @@ -27,9 +26,10 @@ The logic is separated into different classes and concepts: reStructuredText for now, but the system is extensible). Given a file, they return metadata (author, tags, category, etc.) and content (HTML-formatted). -* **Generators** generate the different outputs. For instance, Pelican comes with - ``ArticlesGenerator`` and ``PageGenerator``. Given a configuration, they can do - whatever they want. Most of the time, it's generating files from inputs. +* **Generators** generate the different outputs. For instance, Pelican comes + with ``ArticlesGenerator`` and ``PageGenerator``. Given a configuration, they + can do whatever they want. Most of the time, it's generating files from + inputs. * Pelican also uses templates, so it's easy to write your own theme. The syntax is `Jinja2 `_ and is very easy to learn, so @@ -38,9 +38,9 @@ The logic is separated into different classes and concepts: How to implement a new reader? ============================== -Is there an awesome markup language you want to add to Pelican? -Well, the only thing you have to do is to create a class with a ``read`` -method that returns HTML content and some metadata. +Is there an awesome markup language you want to add to Pelican? Well, the only +thing you have to do is to create a class with a ``read`` method that returns +HTML content and some metadata. Take a look at the Markdown reader:: @@ -65,17 +65,17 @@ Take a look at the Markdown reader:: Simple, isn't it? -If your new reader requires additional Python dependencies, then you should wrap -their ``import`` statements in a ``try...except`` block. Then inside the reader's -class, set the ``enabled`` class attribute to mark import success or failure. -This makes it possible for users to continue using their favourite markup method -without needing to install modules for formats they don't use. +If your new reader requires additional Python dependencies, then you should +wrap their ``import`` statements in a ``try...except`` block. Then inside the +reader's class, set the ``enabled`` class attribute to mark import success or +failure. This makes it possible for users to continue using their favourite +markup method without needing to install modules for formats they don't use. How to implement a new generator? ================================= -Generators have two important methods. You're not forced to create -both; only the existing ones will be called. +Generators have two important methods. You're not forced to create both; only +the existing ones will be called. * ``generate_context``, that is called first, for all the generators. Do whatever you have to do, and update the global context if needed. This @@ -89,5 +89,5 @@ both; only the existing ones will be called. generating the output. :) It's here that you may want to look at the context and call the methods of the ``writer`` object that is passed as the first argument of this function. In the ``PageGenerator`` example, this method will - look at all the pages recorded in the global context and output a file on - the disk (using the writer method ``write_file``) for each page encountered. + look at all the pages recorded in the global context and output a file on the + disk (using the writer method ``write_file``) for each page encountered. diff --git a/docs/pelican-themes.rst b/docs/pelican-themes.rst index e18ebadf..2802777a 100644 --- a/docs/pelican-themes.rst +++ b/docs/pelican-themes.rst @@ -44,7 +44,8 @@ Examples Listing the installed themes """""""""""""""""""""""""""" -With ``pelican-themes``, you can see the available themes by using the ``-l`` or ``--list`` option: +With ``pelican-themes``, you can see the available themes by using the ``-l`` +or ``--list`` option: .. code-block:: console @@ -57,11 +58,15 @@ With ``pelican-themes``, you can see the available themes by using the ``-l`` or two-column@ simple -In this example, we can see there are three themes available: ``notmyidea``, ``simple``, and ``two-column``. +In this example, we can see there are three themes available: ``notmyidea``, +``simple``, and ``two-column``. -``two-column`` is prefixed with an ``@`` because this theme is not copied to the Pelican theme path, but is instead just linked to it (see `Creating symbolic links`_ for details about creating symbolic links). +``two-column`` is prefixed with an ``@`` because this theme is not copied to +the Pelican theme path, but is instead just linked to it (see `Creating +symbolic links`_ for details about creating symbolic links). -Note that you can combine the ``--list`` option with the ``-v`` or ``--verbose`` option to get more verbose output, like this: +Note that you can combine the ``--list`` option with the ``-v`` or +``--verbose`` option to get more verbose output, like this: .. code-block:: console @@ -75,7 +80,8 @@ Installing themes """"""""""""""""" You can install one or more themes using the ``-i`` or ``--install`` option. -This option takes as argument the path(s) of the theme(s) you want to install, and can be combined with the verbose option: +This option takes as argument the path(s) of the theme(s) you want to install, +and can be combined with the verbose option: .. code-block:: console @@ -95,8 +101,9 @@ This option takes as argument the path(s) of the theme(s) you want to install, a Removing themes """"""""""""""" -The ``pelican-themes`` command can also remove themes from the Pelican themes path. -The ``-r`` or ``--remove`` option takes as argument the name(s) of the theme(s) you want to remove, and can be combined with the ``--verbose`` option. +The ``pelican-themes`` command can also remove themes from the Pelican themes +path. The ``-r`` or ``--remove`` option takes as argument the name(s) of the +theme(s) you want to remove, and can be combined with the ``--verbose`` option. .. code-block:: console @@ -113,15 +120,19 @@ The ``-r`` or ``--remove`` option takes as argument the name(s) of the theme(s) Creating symbolic links """"""""""""""""""""""" -``pelican-themes`` can also install themes by creating symbolic links instead of copying entire themes into the Pelican themes path. +``pelican-themes`` can also install themes by creating symbolic links instead +of copying entire themes into the Pelican themes path. -To symbolically link a theme, you can use the ``-s`` or ``--symlink``, which works exactly as the ``--install`` option: +To symbolically link a theme, you can use the ``-s`` or ``--symlink``, which +works exactly as the ``--install`` option: .. code-block:: console # pelican-themes --symlink ~/Dev/Python/pelican-themes/two-column -In this example, the ``two-column`` theme is now symbolically linked to the Pelican themes path, so we can use it, but we can also modify it without having to reinstall it after each modification. +In this example, the ``two-column`` theme is now symbolically linked to the +Pelican themes path, so we can use it, but we can also modify it without having +to reinstall it after each modification. This is useful for theme development: @@ -142,7 +153,9 @@ This is useful for theme development: Doing several things at once """""""""""""""""""""""""""" -The ``--install``, ``--remove`` and ``--symlink`` option are not mutually exclusive, so you can combine them in the same command line to do more than one operation at time, like this: +The ``--install``, ``--remove`` and ``--symlink`` option are not mutually +exclusive, so you can combine them in the same command line to do more than one +operation at time, like this: .. code-block:: console @@ -152,4 +165,5 @@ The ``--install``, ``--remove`` and ``--symlink`` option are not mutually exclus --symlink ~/Dev/Python/pelican-themes/two-column \ --verbose -In this example, the theme ``notmyidea-cms`` is replaced by the theme ``notmyidea-cms-fr`` +In this example, the theme ``notmyidea-cms`` is replaced by the theme +``notmyidea-cms-fr`` diff --git a/docs/plugins.rst b/docs/plugins.rst index 4e0ec6d1..cc74adea 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -22,11 +22,10 @@ Alternatively, another method is to import them and add them to the list:: .. note:: - When experimenting with different plugins (especially the ones that - deal with metadata and content) caching may interfere and the - changes may not be visible. In such cases disable caching with - ``LOAD_CONTENT_CACHE = False`` or use the ``--ignore-cache`` - command-line switch. + When experimenting with different plugins (especially the ones that deal + with metadata and content) caching may interfere and the changes may not be + visible. In such cases disable caching with ``LOAD_CONTENT_CACHE = False`` + or use the ``--ignore-cache`` command-line switch. If your plugins are not in an importable path, you can specify a list of paths via the ``PLUGIN_PATHS`` setting. As shown in the following example, paths in @@ -126,17 +125,17 @@ feed_written path, context, feed invoked each .. warning:: - Avoid ``content_object_init`` signal if you intend to read ``summary`` - or ``content`` properties of the content object. That combination can - result in unresolved links when :ref:`ref-linking-to-internal-content` - (see `pelican-plugins bug #314`_). Use ``_summary`` and ``_content`` - properties instead, or, alternatively, run your plugin at a later - stage (e.g. ``all_generators_finalized``). + Avoid ``content_object_init`` signal if you intend to read ``summary`` or + ``content`` properties of the content object. That combination can result in + unresolved links when :ref:`ref-linking-to-internal-content` (see + `pelican-plugins bug #314`_). Use ``_summary`` and ``_content`` properties + instead, or, alternatively, run your plugin at a later stage (e.g. + ``all_generators_finalized``). .. note:: - After Pelican 3.2, signal names were standardized. Older plugins - may need to be updated to use the new names: + After Pelican 3.2, signal names were standardized. Older plugins may need + to be updated to use the new names: ========================== =========================== Old name New name @@ -162,9 +161,9 @@ How to create a new reader -------------------------- One thing you might want is to add support for your very own input format. -While it might make sense to add this feature in Pelican core, we -wisely chose to avoid this situation and instead have the different readers -defined via plugins. +While it might make sense to add this feature in Pelican core, we wisely chose +to avoid this situation and instead have the different readers defined via +plugins. The rationale behind this choice is mainly that plugins are really easy to write and don't slow down Pelican itself when they're not active. diff --git a/docs/publish.rst b/docs/publish.rst index 9b49ae3f..4dc1e3ef 100644 --- a/docs/publish.rst +++ b/docs/publish.rst @@ -26,13 +26,13 @@ argument, like so:: Note that you must specify the path to the generated *output* file — not the source content. To determine the output file name and location, use the -``--debug`` flag. If desired, ``--write-selected`` -can take a comma-separated list of paths or can be configured as a setting. -(See: :ref:`writing_only_selected_content`) +``--debug`` flag. If desired, ``--write-selected`` can take a comma-separated +list of paths or can be configured as a setting. (See: +:ref:`writing_only_selected_content`) -You can also tell Pelican to watch for your modifications, instead of -manually re-running it every time you want to see your changes. To enable this, -run the ``pelican`` command with the ``-r`` or ``--autoreload`` option. +You can also tell Pelican to watch for your modifications, instead of manually +re-running it every time you want to see your changes. To enable this, run the +``pelican`` command with the ``-r`` or ``--autoreload`` option. Pelican has other command-line switches available. Have a look at the help to see all the options you can use:: @@ -75,17 +75,17 @@ feeds, etc.) that you may have defined:: pelican content -s publishconf.py -To base your publish configuration on top of your ``pelicanconf.py``, you -can import your ``pelicanconf`` settings by including the following line in -your ``publishconf.py``:: +To base your publish configuration on top of your ``pelicanconf.py``, you can +import your ``pelicanconf`` settings by including the following line in your +``publishconf.py``:: from pelicanconf import * -If you have generated a ``publishconf.py`` using ``pelican-quickstart``, -this line is included by default. +If you have generated a ``publishconf.py`` using ``pelican-quickstart``, this +line is included by default. -The steps for deploying your site will depend on where it will be hosted. -If you have SSH access to a server running Nginx or Apache, you might use the +The steps for deploying your site will depend on where it will be hosted. If +you have SSH access to a server running Nginx or Apache, you might use the ``rsync`` tool to transmit your site files:: rsync -avc --delete output/ host.example.com:/var/www/your-site/ @@ -98,17 +98,17 @@ Automation ========== While the ``pelican`` command is the canonical way to generate your site, -automation tools can be used to streamline the generation and publication -flow. One of the questions asked during the ``pelican-quickstart`` process -pertains to whether you want to automate site generation and publication. -If you answered "yes" to that question, a ``tasks.py`` and -``Makefile`` will be generated in the root of your project. These files, -pre-populated with certain information gleaned from other answers provided -during the ``pelican-quickstart`` process, are meant as a starting point and -should be customized to fit your particular needs and usage patterns. If you -find one or both of these automation tools to be of limited utility, these -files can deleted at any time and will not affect usage of the canonical -``pelican`` command. +automation tools can be used to streamline the generation and publication flow. +One of the questions asked during the ``pelican-quickstart`` process pertains +to whether you want to automate site generation and publication. If you +answered "yes" to that question, a ``tasks.py`` and ``Makefile`` will be +generated in the root of your project. These files, pre-populated with certain +information gleaned from other answers provided during the +``pelican-quickstart`` process, are meant as a starting point and should be +customized to fit your particular needs and usage patterns. If you find one or +both of these automation tools to be of limited utility, these files can +deleted at any time and will not affect usage of the canonical ``pelican`` +command. Following are automation tools that "wrap" the ``pelican`` command and can simplify the process of generating, previewing, and uploading your site. @@ -123,9 +123,9 @@ separately. Use the following command to install Invoke, prefixing with pip install invoke -Take a moment to open the ``tasks.py`` file that was generated in your -project root. You will see a number of commands, any one of which can be -renamed, removed, and/or customized to your liking. Using the out-of-the-box +Take a moment to open the ``tasks.py`` file that was generated in your project +root. You will see a number of commands, any one of which can be renamed, +removed, and/or customized to your liking. Using the out-of-the-box configuration, you can generate your site via:: invoke build @@ -155,12 +155,12 @@ needs and preferences. Make ---- -A ``Makefile`` is also automatically created for you when you say "yes" to -the relevant question during the ``pelican-quickstart`` process. The advantage -of this method is that the ``make`` command is built into most POSIX systems -and thus doesn't require installing anything else in order to use it. The -downside is that non-POSIX systems (e.g., Windows) do not include ``make``, -and installing it on those systems can be a non-trivial task. +A ``Makefile`` is also automatically created for you when you say "yes" to the +relevant question during the ``pelican-quickstart`` process. The advantage of +this method is that the ``make`` command is built into most POSIX systems and +thus doesn't require installing anything else in order to use it. The downside +is that non-POSIX systems (e.g., Windows) do not include ``make``, and +installing it on those systems can be a non-trivial task. If you want to use ``make`` to generate your site using the settings in ``pelicanconf.py``, run:: diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 022322c1..a5fdfa60 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -54,9 +54,9 @@ From your site directory, run the ``pelican`` command to generate your site:: pelican content -Your site has now been generated inside the ``output`` directory. (You may see a -warning related to feeds, but that is normal when developing locally and can be -ignored for now.) +Your site has now been generated inside the ``output`` directory. (You may see +a warning related to feeds, but that is normal when developing locally and can +be ignored for now.) Preview your site ----------------- @@ -68,8 +68,9 @@ following command to launch Pelican's web server:: Preview your site by navigating to http://localhost:8000/ in your browser. -Continue reading the other documentation sections for more detail, and check out -the Pelican wiki's Tutorials_ page for links to community-published tutorials. +Continue reading the other documentation sections for more detail, and check +out the Pelican wiki's Tutorials_ page for links to community-published +tutorials. .. _Tutorials: https://github.com/getpelican/pelican/wiki/Tutorials diff --git a/docs/report.rst b/docs/report.rst index f3ddff31..278b5ab2 100644 --- a/docs/report.rst +++ b/docs/report.rst @@ -7,29 +7,27 @@ Some history about Pelican right after writing Pelican, in December 2010. The information may not be up-to-date. -Pelican is a simple static blog generator. It parses markup files -(Markdown or reStructuredText for now) and generates an HTML folder -with all the files in it. -I've chosen to use Python to implement Pelican because it seemed to -be simple and to fit to my needs. I did not wanted to define a class for -each thing, but still wanted to keep my things loosely coupled. -It turns out that it was exactly what I wanted. From time to time, -thanks to the feedback of some users, it took me a very few time to -provide fixes on it. So far, I've re-factored the Pelican code by two +Pelican is a simple static blog generator. It parses markup files (Markdown or +reStructuredText for now) and generates an HTML folder with all the files in +it. I've chosen to use Python to implement Pelican because it seemed to be +simple and to fit to my needs. I did not wanted to define a class for each +thing, but still wanted to keep my things loosely coupled. It turns out that it +was exactly what I wanted. From time to time, thanks to the feedback of some +users, it took me a very few time to provide fixes on it. So far, I've +re-factored the Pelican code by two times; each time took less than 30 minutes. Use case ======== -I was previously using WordPress, a solution you can host on a web -server to manage your blog. Most of the time, I prefer using markup -languages such as Markdown or reStructuredText to type my articles. -To do so, I use vim. I think it is important to let the people choose the -tool they want to write the articles. In my opinion, a blog manager -should just allow you to take any kind of input and transform it to a -weblog. That's what Pelican does. -You can write your articles using the tool you want, and the markup -language you want, and then generate a static HTML weblog. +I was previously using WordPress, a solution you can host on a web server to +manage your blog. Most of the time, I prefer using markup languages such as +Markdown or reStructuredText to type my articles. To do so, I use vim. I think +it is important to let the people choose the tool they want to write the +articles. In my opinion, a blog manager should just allow you to take any kind +of input and transform it to a weblog. That's what Pelican does. You can write +your articles using the tool you want, and the markup language you want, and +then generate a static HTML weblog. .. image:: _static/overall.png @@ -40,39 +38,36 @@ Design process ============== Pelican came from a need I have. I started by creating a single file -application, and I have make it grow to support what it does by now. -To start, I wrote a piece of documentation about what I wanted to do. -Then, I created the content I wanted to parse (the reStructuredText files) -and started experimenting with the code. Pelican was 200 lines long and -contained almost ten functions and one class when it was first usable. +application, and I have make it grow to support what it does by now. To start, +I wrote a piece of documentation about what I wanted to do. Then, I created the +content I wanted to parse (the reStructuredText files) and started +experimenting with the code. Pelican was 200 lines long and contained almost +ten functions and one class when it was first usable. -I have been facing different problems all over the time and wanted to -add features to Pelican while using it. The first change I have done was -to add the support of a settings file. It is possible to pass the options to -the command line, but can be tedious if there is a lot of them. -In the same way, I have added the support of different things over -time: Atom feeds, multiple themes, multiple markup support, etc. -At some point, it appears that the "only one file" mantra was not good -enough for Pelican, so I decided to rework a bit all that, and split this in -multiple different files. +I have been facing different problems all over the time and wanted to add +features to Pelican while using it. The first change I have done was to add the +support of a settings file. It is possible to pass the options to the command +line, but can be tedious if there is a lot of them. In the same way, I have +added the support of different things over time: Atom feeds, multiple themes, +multiple markup support, etc. At some point, it appears that the "only one +file" mantra was not good enough for Pelican, so I decided to rework a bit all +that, and split this in multiple different files. I’ve separated the logic in different classes and concepts: * *writers* are responsible of all the writing process of the files. - They are responsible of writing .html files, RSS feeds and so on. - Since those operations are commonly used, the object is created - once, and then passed to the generators. + They are responsible of writing .html files, RSS feeds and so on. Since those + operations are commonly used, the object is created once, and then passed to + the generators. * *readers* are used to read from various formats (Markdown and - reStructuredText for now, but the system is extensible). Given a - file, they return metadata (author, tags, category, etc) and - content (HTML formatted). + reStructuredText for now, but the system is extensible). Given a file, they + return metadata (author, tags, category, etc) and content (HTML formatted). * *generators* generate the different outputs. For instance, Pelican - comes with an ArticlesGenerator and PagesGenerator, into - others. Given a configuration, they can do whatever you want - them to do. Most of the time it's generating files from inputs - (user inputs and files). + comes with an ArticlesGenerator and PagesGenerator, into others. Given a + configuration, they can do whatever you want them to do. Most of the time + it's generating files from inputs (user inputs and files). I also deal with contents objects. They can be ``Articles``, ``Pages``, ``Quotes``, or whatever you want. They are defined in the ``contents.py`` @@ -90,32 +85,30 @@ whole picture. I do use duck typing and not interfaces. Internally, the following process is followed: -* First of all, the command line is parsed, and some content from - the user is used to initialize the different generator objects. +* First of all, the command line is parsed, and some content from the user is + used to initialize the different generator objects. -* A ``context`` is created. It contains the settings from the command - line and a settings file if provided. +* A ``context`` is created. It contains the settings from the command line and + a settings file if provided. * The ``generate_context`` method of each generator is called, updating the context. +* The writer is created and given to the ``generate_output`` method of each + generator. -* The writer is created and given to the ``generate_output`` method of - each generator. - -I make two calls because it is important that when the output is -generated by the generators, the context will not change. In other -words, the first method ``generate_context`` should modify the context, -whereas the second ``generate_output`` method should not. +I make two calls because it is important that when the output is generated by +the generators, the context will not change. In other words, the first method +``generate_context`` should modify the context, whereas the second +``generate_output`` method should not. Then, it is up to the generators to do what the want, in the -``generate_context`` and ``generate_content`` method. -Taking the ``ArticlesGenerator`` class will help to understand some others -concepts. Here is what happens when calling the ``generate_context`` -method: +``generate_context`` and ``generate_content`` method. Taking the +``ArticlesGenerator`` class will help to understand some others concepts. Here +is what happens when calling the ``generate_context`` method: -* Read the folder “path”, looking for restructured text files, load - each of them, and construct a content object (``Article``) with it. To do so, - use ``Reader`` objects. +* Read the folder “path”, looking for restructured text files, load each of + them, and construct a content object (``Article``) with it. To do so, use + ``Reader`` objects. * Update the ``context`` with all those articles. -Then, the ``generate_content`` method uses the ``context`` and the ``writer`` to -generate the wanted output. +Then, the ``generate_content`` method uses the ``context`` and the ``writer`` +to generate the wanted output. diff --git a/docs/settings.rst b/docs/settings.rst index 28b68980..d465ddff 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -1,8 +1,8 @@ Settings ######## -Pelican is configurable thanks to a settings file you can pass to -the command line:: +Pelican is configurable thanks to a settings file you can pass to the command +line:: pelican content -s path/to/your/pelicanconf.py @@ -11,10 +11,10 @@ be named ``pelicanconf.py`` by default. .. note:: - When experimenting with different settings (especially the metadata - ones) caching may interfere and the changes may not be visible. In - such cases disable caching with ``LOAD_CONTENT_CACHE = False`` or - use the ``--ignore-cache`` command-line switch. + When experimenting with different settings (especially the metadata ones) + caching may interfere and the changes may not be visible. In such cases + disable caching with ``LOAD_CONTENT_CACHE = False`` or use the + ``--ignore-cache`` command-line switch. Settings are configured in the form of a Python module (a file). There is an `example settings file @@ -35,8 +35,8 @@ quotation marks. Unless otherwise specified, settings that refer to paths can be either absolute or relative to the configuration file. The settings you define in the -configuration file will be passed to the templates, which allows you to use your -settings to add site-wide content. +configuration file will be passed to the templates, which allows you to use +your settings to add site-wide content. Here is a list of settings for Pelican: @@ -89,8 +89,8 @@ Basic settings .. data:: JINJA_ENVIRONMENT = {'trim_blocks': True, 'lstrip_blocks': True} A dictionary of custom Jinja2 environment variables you want to use. This - also includes a list of extensions you may want to include. - See `Jinja Environment documentation`_. + also includes a list of extensions you may want to include. See `Jinja + Environment documentation`_. .. data:: JINJA_FILTERS = {} @@ -212,8 +212,8 @@ Basic settings your SITEURL; if you do not, feeds will not be generated with properly-formed URLs. If your site is available via HTTPS, this setting should begin with ``https://`` — otherwise use ``http://``. Then append your - domain, with no trailing slash at the end. - Example: ``SITEURL = 'https://example.com'`` + domain, with no trailing slash at the end. Example: ``SITEURL = + 'https://example.com'`` .. data:: STATIC_PATHS = ['images'] @@ -239,17 +239,17 @@ Basic settings .. data:: STATIC_CREATE_LINKS = False - Create links instead of copying files. If the content and output - directories are on the same device, then create hard links. Falls - back to symbolic links if the output directory is on a different - filesystem. If symlinks are created, don't forget to add the ``-L`` - or ``--copy-links`` option to rsync when uploading your site. + Create links instead of copying files. If the content and output directories + are on the same device, then create hard links. Falls back to symbolic + links if the output directory is on a different filesystem. If symlinks are + created, don't forget to add the ``-L`` or ``--copy-links`` option to rsync + when uploading your site. .. data:: STATIC_CHECK_IF_MODIFIED = False - If set to ``True``, and ``STATIC_CREATE_LINKS`` is ``False``, compare - mtimes of content and output files, and only copy content files that - are newer than existing output files. + If set to ``True``, and ``STATIC_CREATE_LINKS`` is ``False``, compare mtimes + of content and output files, and only copy content files that are newer than + existing output files. .. data:: TYPOGRIFY = False @@ -347,11 +347,11 @@ URL settings ============ The first thing to understand is that there are currently two supported methods -for URL formation: *relative* and *absolute*. Relative URLs are useful -when testing locally, and absolute URLs are reliable and most useful when +for URL formation: *relative* and *absolute*. Relative URLs are useful when +testing locally, and absolute URLs are reliable and most useful when publishing. One method of supporting both is to have one Pelican configuration -file for local development and another for publishing. To see an example of this -type of setup, use the ``pelican-quickstart`` script as described in the +file for local development and another for publishing. To see an example of +this type of setup, use the ``pelican-quickstart`` script as described in the :doc:`Installation ` section, which will produce two separate configuration files for local development and publishing, respectively. @@ -365,8 +365,8 @@ and pages anywhere you want. .. 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. + particular file, Pelican will rely on the file's ``mtime`` timestamp. Check + the `Python datetime documentation`_ for more information. .. _Python datetime documentation: http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior @@ -387,10 +387,9 @@ Example usage:: PAGE_SAVE_AS = 'pages/{slug}/index.html' This would save your articles into something like -``/posts/2011/Aug/07/sample-post/index.html``, -save your pages into ``/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/index.html``, save your pages into +``/pages/about/index.html``, and render them available at URLs of +``/posts/2011/Aug/07/sample-post/`` and ``/pages/about/``, respectively. .. data:: RELATIVE_URLS = False @@ -528,9 +527,10 @@ respectively. Pelican can optionally create per-year, per-month, and per-day archives of your posts. These secondary archives are disabled by default but are automatically -enabled if you supply format strings for their respective ``_SAVE_AS`` settings. -Period archives fit intuitively with the hierarchical model of web URLs and can -make it easier for readers to navigate through the posts you've written over time. +enabled if you supply format strings for their respective ``_SAVE_AS`` +settings. Period archives fit intuitively with the hierarchical model of web +URLs and can make it easier for readers to navigate through the posts you've +written over time. Example usage:: @@ -543,9 +543,8 @@ posts for the month at ``posts/2011/Aug/index.html``. .. note:: Period archives work best when the final path segment is ``index.html``. - This way a reader can remove a portion of your URL and automatically - arrive at an appropriate archive of posts, without having to specify - a page name. + This way a reader can remove a portion of your URL and automatically arrive + at an appropriate archive of posts, without having to specify a page name. ``DIRECT_TEMPLATES`` work a bit differently than noted above. Only the ``_SAVE_AS`` settings are available, but it is available for any direct @@ -585,7 +584,8 @@ template. URLs for direct template pages are theme-dependent. Some themes use corresponding ``*_URL`` setting as string, while others hard-code them: -``'archives.html'``, ``'authors.html'``, ``'categories.html'``, ``'tags.html'``. +``'archives.html'``, ``'authors.html'``, ``'categories.html'``, +``'tags.html'``. .. data:: SLUG_REGEX_SUBSTITUTIONS = [ (r'[^\w\s-]', ''), # remove non-alphabetical/whitespace/'-' chars @@ -604,11 +604,13 @@ corresponding ``*_URL`` setting as string, while others hard-code them: .. data:: AUTHOR_REGEX_SUBSTITUTIONS = SLUG_REGEX_SUBSTITUTIONS - Regex substitutions for author slugs. Defaults to ``SLUG_REGEX_SUBSTITUTIONS``. + Regex substitutions for author slugs. Defaults to + ``SLUG_REGEX_SUBSTITUTIONS``. .. data:: CATEGORY_REGEX_SUBSTITUTIONS = SLUG_REGEX_SUBSTITUTIONS - Regex substitutions for category slugs. Defaults to ``SLUG_REGEX_SUBSTITUTIONS``. + Regex substitutions for category slugs. Defaults to + ``SLUG_REGEX_SUBSTITUTIONS``. .. data:: TAG_REGEX_SUBSTITUTIONS = SLUG_REGEX_SUBSTITUTIONS @@ -784,13 +786,13 @@ Metadata unlike some other Pelican file settings. Not all metadata needs to be :ref:`embedded in source file itself -`. For example, blog posts are often named -following a ``YYYY-MM-DD-SLUG.rst`` pattern, or nested into -``YYYY/MM/DD-SLUG`` directories. To extract metadata from the -filename or path, set ``FILENAME_METADATA`` or ``PATH_METADATA`` to -regular expressions that use Python's `group name notation`_ ``(?P…)``. -If you want to attach additional metadata but don't want to encode -it in the path, you can set ``EXTRA_PATH_METADATA``: +`. For example, blog posts are often named following a +``YYYY-MM-DD-SLUG.rst`` pattern, or nested into ``YYYY/MM/DD-SLUG`` +directories. To extract metadata from the filename or path, set +``FILENAME_METADATA`` or ``PATH_METADATA`` to regular expressions that use +Python's `group name notation`_ ``(?P…)``. If you want to attach +additional metadata but don't want to encode it in the path, you can set +``EXTRA_PATH_METADATA``: .. parsed-literal:: @@ -804,8 +806,8 @@ it in the path, you can set ``EXTRA_PATH_METADATA``: }, } -This can be a convenient way to shift the installed location of a -particular file: +This can be a convenient way to shift the installed location of a particular +file: .. parsed-literal:: @@ -829,8 +831,8 @@ Feed settings By default, Pelican uses Atom feeds. However, it is also possible to use RSS feeds if you prefer. -Pelican generates category feeds as well as feeds for all your articles. It does -not generate feeds for tags by default, but it is possible to do so using +Pelican generates category feeds as well as feeds for all your articles. It +does not generate feeds for tags by default, but it is possible to do so using the ``TAG_FEED_ATOM`` and ``TAG_FEED_RSS`` settings: .. data:: FEED_DOMAIN = None, i.e. base URL is "/" @@ -944,7 +946,8 @@ the ``TAG_FEED_ATOM`` and ``TAG_FEED_RSS`` settings: to ``False``, the full content will be included instead. This setting doesn't affect Atom feeds, only RSS ones. -If you don't want to generate some or any of these feeds, set the above variables to ``None``. +If you don't want to generate some or any of these feeds, set the above +variables to ``None``. .. [2] ``%s`` is replaced by name of the category / author / tag. @@ -954,17 +957,18 @@ FeedBurner If you want to use FeedBurner for your feed, you will likely need to decide upon a unique identifier. For example, if your site were called "Thyme" and -hosted on the www.example.com domain, you might use "thymefeeds" as your -unique identifier, which we'll use throughout this section for illustrative -purposes. In your Pelican settings, set the ``FEED_ATOM`` attribute to +hosted on the www.example.com domain, you might use "thymefeeds" as your unique +identifier, which we'll use throughout this section for illustrative purposes. +In your Pelican settings, set the ``FEED_ATOM`` attribute to ``thymefeeds/main.xml`` to create an Atom feed with an original address of ``http://www.example.com/thymefeeds/main.xml``. Set the ``FEED_DOMAIN`` -attribute to ``http://feeds.feedburner.com``, or ``http://feeds.example.com`` if -you are using a CNAME on your own domain (i.e., FeedBurner's "MyBrand" feature). +attribute to ``http://feeds.feedburner.com``, or ``http://feeds.example.com`` +if you are using a CNAME on your own domain (i.e., FeedBurner's "MyBrand" +feature). There are two fields to configure in the `FeedBurner -`_ interface: "Original Feed" and "Feed -Address". In this example, the "Original Feed" would be +`_ interface: "Original Feed" and "Feed Address". +In this example, the "Original Feed" would be ``http://www.example.com/thymefeeds/main.xml`` and the "Feed Address" suffix would be ``thymefeeds/main.xml``. @@ -972,10 +976,10 @@ would be ``thymefeeds/main.xml``. Pagination ========== -The default behaviour of Pelican is to list all the article titles along -with a short description on the index page. While this works well for -small-to-medium sites, sites with a large quantity of articles will probably -benefit from paginating this list. +The default behaviour of Pelican is to list all the article titles along with a +short description on the index page. While this works well for small-to-medium +sites, sites with a large quantity of articles will probably benefit from +paginating this list. You can use the following settings to configure the pagination. @@ -1014,9 +1018,9 @@ change this. It takes a sequence of triples, where each triple consists of:: For ``page_url`` and ``page_save_as``, you may use a number of variables. ``{url}`` and ``{save_as}`` correspond respectively to the ``*_URL`` and ``*_SAVE_AS`` values of the corresponding page type (e.g. ``ARTICLE_SAVE_AS``). -If ``{save_as} == foo/bar.html``, then ``{name} == foo/bar`` and -``{extension} == .html``. ``{base_name}`` equals ``{name}`` except that it -strips trailing ``/index`` if present. ``{number}`` equals the page number. +If ``{save_as} == foo/bar.html``, then ``{name} == foo/bar`` and ``{extension} +== .html``. ``{base_name}`` equals ``{name}`` except that it strips trailing +``/index`` if present. ``{number}`` equals the page number. For example, if you want to leave the first page unchanged, but place subsequent pages at ``.../page/2/`` etc, you could set ``PAGINATION_PATTERNS`` @@ -1031,8 +1035,8 @@ as follows:: Translations ============ -Pelican offers a way to translate articles. See the :doc:`Content ` section for -more information. +Pelican offers a way to translate articles. See the :doc:`Content ` +section for more information. .. data:: DEFAULT_LANG = 'en' @@ -1046,9 +1050,9 @@ more information. .. data:: PAGE_TRANSLATION_ID = 'slug' - The metadata attribute(s) used to identify which pages are translations - of one another. May be a string or a collection of strings. Set to ``None`` - or ``False`` to disable the identification of translations. + The metadata attribute(s) used to identify which pages are translations of + one another. May be a string or a collection of strings. Set to ``None`` or + ``False`` to disable the identification of translations. .. data:: TRANSLATION_FEED_ATOM = 'feeds/all-%s.atom.xml' @@ -1106,8 +1110,9 @@ Ordering content Themes ====== -Creating Pelican themes is addressed in a dedicated section (see :ref:`theming-pelican`). -However, here are the settings that are related to themes. +Creating Pelican themes is addressed in a dedicated section (see +:ref:`theming-pelican`). However, here are the settings that are related to +themes. .. data:: THEME @@ -1152,11 +1157,13 @@ setting or by passing the ``-t`` option to the ``pelican`` command: * notmyidea * simple (a synonym for "plain text" :) -There are a number of other themes available at https://github.com/getpelican/pelican-themes. -Pelican comes with :doc:`pelican-themes`, a small script for managing themes. +There are a number of other themes available at +https://github.com/getpelican/pelican-themes. Pelican comes with +:doc:`pelican-themes`, a small script for managing themes. -You can define your own theme, either by starting from scratch or by duplicating -and modifying a pre-existing theme. Here is :doc:`a guide on how to create your theme `. +You can define your own theme, either by starting from scratch or by +duplicating and modifying a pre-existing theme. Here is :doc:`a guide on how to +create your theme `. Following are example ways to specify your preferred theme:: @@ -1169,8 +1176,8 @@ Following are example ways to specify your preferred theme:: # Specify a customized theme, via absolute path THEME = "/home/myuser/projects/mysite/themes/mycustomtheme" -The built-in ``notmyidea`` theme can make good use of the following settings. Feel -free to use them in your themes as well. +The built-in ``notmyidea`` theme can make good use of the following settings. +Feel free to use them in your themes as well. .. data:: SITESUBTITLE @@ -1256,9 +1263,9 @@ can be quite tricky. In order to filter out redundant log messages, Pelican comes with the ``LOG_FILTER`` setting. ``LOG_FILTER`` should be a list of tuples ``(level, msg)``, each of them being -composed of the logging level (up to ``warning``) and the message to be ignored. -Simply populate the list with the log messages you want to hide, and they will -be filtered out. +composed of the logging level (up to ``warning``) and the message to be +ignored. Simply populate the list with the log messages you want to hide, and +they will be filtered out. For example:: @@ -1274,6 +1281,7 @@ For example:: LOG_FILTER = [(logging.WARN, 'Empty alt attribute for image %s in %s')] .. Warning:: + Silencing messages by templates is a dangerous feature. It is possible to unintentionally filter out multiple message types with the same template (including messages from future Pelican versions). Proceed with caution. @@ -1288,16 +1296,15 @@ For example:: Reading only modified content ============================= -To speed up the build process, Pelican can optionally read only articles -and pages with modified content. +To speed up the build process, Pelican can optionally read only articles and +pages with modified content. When Pelican is about to read some content source file: 1. The hash or modification time information for the file from a - previous build are loaded from a cache file if ``LOAD_CONTENT_CACHE`` - is ``True``. These files are stored in the ``CACHE_PATH`` - directory. If the file has no record in the cache file, it is read - as usual. + previous build are loaded from a cache file if ``LOAD_CONTENT_CACHE`` is + ``True``. These files are stored in the ``CACHE_PATH`` directory. If the + file has no record in the cache file, it is read as usual. 2. The file is checked according to ``CHECK_MODIFIED_METHOD``: - If set to ``'mtime'``, the modification time of the file is @@ -1305,47 +1312,45 @@ When Pelican is about to read some content source file: - If set to a name of a function provided by the ``hashlib`` module, e.g. ``'md5'``, the file hash is checked. - If set to anything else or the necessary information about the - file cannot be found in the cache file, the content is read as - usual. + file cannot be found in the cache file, the content is read as usual. 3. If the file is considered unchanged, the content data saved in a - previous build corresponding to the file is loaded from the cache, - and the file is not read. + previous build corresponding to the file is loaded from the cache, and the + file is not read. 4. If the file is considered changed, the file is read and the new - modification information and the content data are saved to the - cache if ``CACHE_CONTENT`` is ``True``. + modification information and the content data are saved to the cache if + ``CACHE_CONTENT`` is ``True``. -If ``CONTENT_CACHING_LAYER`` is set to ``'reader'`` (the default), -the raw content and metadata returned by a reader are cached. If this -setting is instead set to ``'generator'``, the processed content -object is cached. Caching the processed content object may conflict -with plugins (as some reading related signals may be skipped) and the -``WITH_FUTURE_DATES`` functionality (as the ``draft`` status of the -cached content objects would not change automatically over time). +If ``CONTENT_CACHING_LAYER`` is set to ``'reader'`` (the default), the raw +content and metadata returned by a reader are cached. If this setting is +instead set to ``'generator'``, the processed content object is cached. Caching +the processed content object may conflict with plugins (as some reading related +signals may be skipped) and the ``WITH_FUTURE_DATES`` functionality (as the +``draft`` status of the cached content objects would not change automatically +over time). -Checking modification times is faster than comparing file hashes, -but it is not as reliable because ``mtime`` information can be lost, -e.g., when copying content source files using the ``cp`` or ``rsync`` -commands without the ``mtime`` preservation mode (which for ``rsync`` -can be invoked by passing the ``--archive`` flag). +Checking modification times is faster than comparing file hashes, but it is not +as reliable because ``mtime`` information can be lost, e.g., when copying +content source files using the ``cp`` or ``rsync`` commands without the +``mtime`` preservation mode (which for ``rsync`` can be invoked by passing the +``--archive`` flag). -The cache files are Python pickles, so they may not be readable by -different versions of Python as the pickle format often changes. If -such an error is encountered, it is caught and the cache file is -rebuilt automatically in the new format. The cache files will also be -rebuilt after the ``GZIP_CACHE`` setting has been changed. +The cache files are Python pickles, so they may not be readable by different +versions of Python as the pickle format often changes. If such an error is +encountered, it is caught and the cache file is rebuilt automatically in the +new format. The cache files will also be rebuilt after the ``GZIP_CACHE`` +setting has been changed. -The ``--ignore-cache`` command-line option is useful when the -whole cache needs to be regenerated, such as when making modifications -to the settings file that will affect the cached content, or just for -debugging purposes. When Pelican runs in autoreload mode, modification -of the settings file will make it ignore the cache automatically if -``AUTORELOAD_IGNORE_CACHE`` is ``True``. +The ``--ignore-cache`` command-line option is useful when the whole cache needs +to be regenerated, such as when making modifications to the settings file that +will affect the cached content, or just for debugging purposes. When Pelican +runs in autoreload mode, modification of the settings file will make it ignore +the cache automatically if ``AUTORELOAD_IGNORE_CACHE`` is ``True``. -Note that even when using cached content, all output is always -written, so the modification times of the generated ``*.html`` files -will always change. Therefore, ``rsync``-based uploading may benefit -from the ``--checksum`` option. +Note that even when using cached content, all output is always written, so the +modification times of the generated ``*.html`` files will always change. +Therefore, ``rsync``-based uploading may benefit from the ``--checksum`` +option. .. _writing_only_selected_content: @@ -1353,16 +1358,14 @@ from the ``--checksum`` option. Writing only selected content ============================= -When only working on a single article or page, or making tweaks to -your theme, it is often desirable to generate and review your work -as quickly as possible. In such cases, generating and writing the -entire site output is often unnecessary. By specifying only the -desired files as output paths in the ``WRITE_SELECTED`` list, -**only** those files will be written. This list can be also specified -on the command line using the ``--write-selected`` option, which -accepts a comma-separated list of output file paths. By default this -list is empty, so all output is written. See :ref:`site_generation` for -more details. +When only working on a single article or page, or making tweaks to your theme, +it is often desirable to generate and review your work as quickly as possible. +In such cases, generating and writing the entire site output is often +unnecessary. By specifying only the desired files as output paths in the +``WRITE_SELECTED`` list, **only** those files will be written. This list can be +also specified on the command line using the ``--write-selected`` option, which +accepts a comma-separated list of output file paths. By default this list is +empty, so all output is written. See :ref:`site_generation` for more details. Example settings diff --git a/docs/themes.rst b/docs/themes.rst index e94ff08e..3e186ee2 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -3,13 +3,14 @@ Creating themes ############### -To generate its HTML output, Pelican uses the `Jinja `_ -templating engine due to its flexibility and straightforward syntax. If you want -to create your own theme, feel free to take inspiration from the `"simple" theme +To generate its HTML output, Pelican uses the `Jinja +`_ templating engine due to its flexibility and +straightforward syntax. If you want to create your own theme, feel free to take +inspiration from the `"simple" theme `_. -To generate your site using a theme you have created (or downloaded manually and -then modified), you can specify that theme via the ``-t`` flag:: +To generate your site using a theme you have created (or downloaded manually +and then modified), you can specify that theme via the ``-t`` flag:: pelican content -s pelicanconf.py -t /projects/your-site/themes/your-theme @@ -42,9 +43,9 @@ To make your own theme, you must follow the following structure:: `theme` folder. The above filesystem layout includes CSS and image folders, but those are just examples. Put what you need here. -* `templates` contains all the templates that will be used to generate the content. - The template files listed above are mandatory; you can add your own templates - if it helps you keep things organized while creating your theme. +* `templates` contains all the templates that will be used to generate the + content. The template files listed above are mandatory; you can add your own + templates if it helps you keep things organized while creating your theme. .. _templates-variables: @@ -93,13 +94,13 @@ draft_pages The list of draft pages Sorting ------- -URL wrappers (currently categories, tags, and authors), have -comparison methods that allow them to be easily sorted by name:: +URL wrappers (currently categories, tags, and authors), have comparison methods +that allow them to be easily sorted by name:: {% for tag, articles in tags|sort %} -If you want to sort based on different criteria, `Jinja's sort -command`__ has a number of options. +If you want to sort based on different criteria, `Jinja's sort command`__ has a +number of options. __ http://jinja.pocoo.org/docs/templates/#sort @@ -108,13 +109,12 @@ Date Formatting --------------- Pelican formats the date according to your settings and locale -(``DATE_FORMATS``/``DEFAULT_DATE_FORMAT``) and provides a -``locale_date`` attribute. On the other hand, the ``date`` attribute will -be a `datetime`_ object. If you need custom formatting for a date -different than your settings, use the Jinja filter ``strftime`` -that comes with Pelican. Usage is same as Python `strftime`_ format, -but the filter will do the right thing and format your date according -to the locale given in your settings:: +(``DATE_FORMATS``/``DEFAULT_DATE_FORMAT``) and provides a ``locale_date`` +attribute. On the other hand, the ``date`` attribute will be a `datetime`_ +object. If you need custom formatting for a date different than your settings, +use the Jinja filter ``strftime`` that comes with Pelican. Usage is same as +Python `strftime`_ format, but the filter will do the right thing and format +your date according to the locale given in your settings:: {{ article.date|strftime('%d %B %Y') }} @@ -127,7 +127,8 @@ index.html This is the home page or index of your blog, generated at ``index.html``. -If pagination is active, subsequent pages will reside in ``index{number}.html``. +If pagination is active, subsequent pages will reside in +``index{number}.html``. ====================== =================================================== Variable Description @@ -153,8 +154,8 @@ page_name 'index' -- useful for pagination links author.html ------------- -This template will be processed for each of the existing authors, with -output generated according to the ``AUTHOR_SAVE_AS`` setting (`Default:` +This template will be processed for each of the existing authors, with output +generated according to the ``AUTHOR_SAVE_AS`` setting (`Default:` ``author/{slug}.html``). If pagination is active, subsequent pages will by default reside at ``author/{slug}{number}.html``. @@ -221,10 +222,9 @@ page_name CATEGORY_URL where everything after `{slug}` is article.html ------------- -This template will be processed for each article, with -output generated according to the ``ARTICLE_SAVE_AS`` setting (`Default:` -``{slug}.html``). The following variables are available when -rendering. +This template will be processed for each article, with output generated +according to the ``ARTICLE_SAVE_AS`` setting (`Default:` ``{slug}.html``). The +following variables are available when rendering. ============= =================================================== Variable Description @@ -233,9 +233,9 @@ article The article object to be displayed category The name of the category for the current article ============= =================================================== -Any metadata that you put in the header of the article source file -will be available as fields on the ``article`` object. The field name will be -the same as the name of the metadata field, except in all-lowercase characters. +Any metadata that you put in the header of the article source file will be +available as fields on the ``article`` object. The field name will be the same +as the name of the metadata field, except in all-lowercase characters. For example, you could add a field called `FacebookImage` to your article metadata, as shown below: @@ -251,8 +251,8 @@ metadata, as shown below: FacebookImage: http://franciscabrel.com/images/pythonlove.png This new metadata will be made available as `article.facebookimage` in your -`article.html` template. This would allow you, for example, to specify an -image for the Facebook open graph tags that will change for each article: +`article.html` template. This would allow you, for example, to specify an image +for the Facebook open graph tags that will change for each article: .. code-block:: html+jinja @@ -262,10 +262,9 @@ image for the Facebook open graph tags that will change for each article: page.html --------- -This template will be processed for each page, with -output generated according to the ``PAGE_SAVE_AS`` setting (`Default:` -``pages/{slug}.html``). The following variables are available when -rendering. +This template will be processed for each page, with output generated according +to the ``PAGE_SAVE_AS`` setting (`Default:` ``pages/{slug}.html``). The +following variables are available when rendering. ============= =================================================== Variable Description @@ -278,10 +277,10 @@ page The page object to be displayed. You can access its tag.html -------- -This template will be processed for each tag, with -output generated according to the ``TAG_SAVE_AS`` setting (`Default:` -``tag/{slug}.html``). If pagination is active, subsequent pages will by -default reside at ``tag/{slug}{number}.html``. +This template will be processed for each tag, with output generated according +to the ``TAG_SAVE_AS`` setting (`Default:` ``tag/{slug}.html``). If pagination +is active, subsequent pages will by default reside at +``tag/{slug}{number}.html``. ====================== =================================================== Variable Description @@ -312,9 +311,9 @@ page_name TAG_URL where everything after `{slug}` is removed period_archives.html -------------------- -This template will be processed for each year of your posts if a path -for ``YEAR_ARCHIVE_SAVE_AS`` is defined, each month if ``MONTH_ARCHIVE_SAVE_AS`` -is defined, and each day if ``DAY_ARCHIVE_SAVE_AS`` is defined. +This template will be processed for each year of your posts if a path for +``YEAR_ARCHIVE_SAVE_AS`` is defined, each month if ``MONTH_ARCHIVE_SAVE_AS`` is +defined, and each day if ``DAY_ARCHIVE_SAVE_AS`` is defined. =================== =================================================== Variable Description @@ -464,9 +463,9 @@ Since version 3.0, Pelican supports inheritance from the ``simple`` theme, so you can re-use the ``simple`` theme templates in your own themes. If one of the mandatory files in the ``templates/`` directory of your theme is -missing, it will be replaced by the matching template from the ``simple`` theme. -So if the HTML structure of a template in the ``simple`` theme is right for you, -you don't have to write a new template from scratch. +missing, it will be replaced by the matching template from the ``simple`` +theme. So if the HTML structure of a template in the ``simple`` theme is right +for you, you don't have to write a new template from scratch. You can also extend templates from the ``simple`` theme in your own themes by using the ``{% extends %}`` directive as in the following example: diff --git a/docs/tips.rst b/docs/tips.rst index b5df39ef..e5e89e91 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -8,8 +8,8 @@ Custom 404 Pages When a browser requests a resource that the web server cannot find, the web server usually displays a generic "File not found" (404) error page that can be -stark and unsightly. One way to provide an error page that matches the theme -of your site is to create a custom 404 page (*not* an article), such as this +stark and unsightly. One way to provide an error page that matches the theme of +your site is to create a custom 404 page (*not* an article), such as this Markdown-formatted example stored in ``content/pages/404.md``:: Title: Not Found @@ -29,8 +29,8 @@ For Apache:: ErrorDocument 404 /404.html -For Amazon S3, first navigate to the ``Static Site Hosting`` menu in the -bucket settings on your AWS cosole. From there:: +For Amazon S3, first navigate to the ``Static Site Hosting`` menu in the bucket +settings on your AWS cosole. From there:: Error Document: 404.html @@ -67,15 +67,17 @@ already exist). The ``git push origin gh-pages`` command updates the remote ``gh-pages`` branch, effectively publishing the Pelican site. .. note:: - The ``github`` target of the Makefile (and the ``gh_pages`` task of ``tasks.py``) - created by the ``pelican-quickstart`` command - publishes the Pelican site as Project Pages, as described above. + + The ``github`` target of the Makefile (and the ``gh_pages`` task of + ``tasks.py``) created by the ``pelican-quickstart`` command publishes the + Pelican site as Project Pages, as described above. .. note:: ghp-import on Windows - Until `ghp-import Pull Request #25 `_ - is accepted, you will need to install a custom build of ghp-import: - ``pip install https://github.com/chevah/ghp-import/archive/win-support.zip`` + Until `ghp-import Pull Request #25 + `_ is accepted, you will need + to install a custom build of ghp-import: ``pip install + https://github.com/chevah/ghp-import/archive/win-support.zip`` User Pages ---------- @@ -99,13 +101,17 @@ by the ``ghp-import`` command) to the ``elemoine.github.io`` repository's To publish your Pelican site as User Pages, feel free to adjust the ``github`` target of the Makefile. -Another option for publishing to User Pages is to generate the output files in the root directory of the project. +Another option for publishing to User Pages is to generate the output files in +the root directory of the project. -For example, your main project folder is ``.github.io`` and you can create the Pelican project in a subdirectory called ``Pelican``. Then from inside the ``Pelican`` folder you can run:: +For example, your main project folder is ``.github.io`` and you can +create the Pelican project in a subdirectory called ``Pelican``. Then from +inside the ``Pelican`` folder you can run:: $ pelican content -o .. -s pelicanconf.py -Now you can push the whole project ``.github.io`` to the master branch of your GitHub repository:: +Now you can push the whole project ``.github.io`` to the master +branch of your GitHub repository:: $ git push origin master @@ -120,8 +126,8 @@ relevant `GitHub docs `_. Update your site on each commit ------------------------------- -To automatically update your Pelican site on each commit, you can create -a post-commit hook. For example, you can add the following to +To automatically update your Pelican site on each commit, you can create a +post-commit hook. For example, you can add the following to ``.git/hooks/post-commit``:: pelican content -o output -s pelicanconf.py && ghp-import output && git push origin gh-pages @@ -142,8 +148,8 @@ output directory. For example:: Note: use forward slashes, ``/``, even on Windows. -You can also use the ``EXTRA_PATH_METADATA`` mechanism -to place a ``favicon.ico`` or ``robots.txt`` at the root of any site. +You can also use the ``EXTRA_PATH_METADATA`` mechanism to place a +``favicon.ico`` or ``robots.txt`` at the root of any site. How to add YouTube or Vimeo Videos ==================================