pelican-readtime


Namepelican-readtime JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/JenkinsDev/pelican-readtime
SummaryPlugin for Pelican that computes average read time.
upload_time2024-11-20 19:40:14
maintainerDavid Jenkins, Deepak Bhalla, Jonathan Dektiar
docs_urlNone
authorDavid Jenkins, Deepak Bhalla, Jonathan Dektiar
requires_pythonNone
licenseMIT
keywords pelican blogging blog static webdevelopment plugin pelican-plugin readtime python python3 python2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Readtime plugin for pelican
===========================

.. image:: https://travis-ci.com/JenkinsDev/pelican-readtime.svg?branch=master
    :target: https://travis-ci.com/JenkinsDev/pelican-readtime

Plugin for `Pelican`_ that computes a piece of content's read time.

It adds a ``readtime`` and ``readtime_string`` attributes to every
article and/or page, with the time estimation for reading the article.

Setting Up
----------

Adding ‘ReadTime’ to the list of plugins:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**In pelicanconf.py:**

.. code:: python

    PLUGINS = [
        ... ,
        'readtime'
    ]

1. Words Per Minute Only
^^^^^^^^^^^^^^^^^^^^^^^^

In your settings you would use assign the ``READTIME_WPM`` variable to
an integer like so:

**In pelicanconf.py:**

.. code:: python

    READTIME_WPM = 180

Every article’s read time would be calculated using this average words
per minute count. (See the Usage section for how to use the calculated
read times in templates). This is the simplest read time method.

2. Words Per Minute per language
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is the preferred method if you are dealing with multiple languages.
Take a look at the following settings

**In pelicanconf.py:**

.. code:: python

    READTIME_WPM = {
        'default': {
            'wpm': 200,
            'min_singular': 'minute',
            'min_plural': 'minutes',
            'sec_singular': 'second',
            'sec_plural': 'seconds'
        },
        'es': {
            'wpm': 220,
            'min_singular': 'minuto',
            'min_plural': 'minutos',
            'sec_singular': 'segundo',
            'sec_plural': 'segundos'
        }
    }

In this example the default reading time for all articles is 200 words
per minute. Any articles in spanish will be calculated at 220 wpm. This
is useful for information dense languages where the read time varies
rapidly.

Chances are the average reading time will not vary rapidly from language
to language, however using this method also allows you to set plurals
which make templating easier in the long run.

Usage
-----

Four variables are accessible through the read time plugin:
**readtime**, **readtime\_string**, **readtime\_with\_seconds**, and **readtime\_string\_with\_seconds**

.. code:: html

    {% if article.readtime %} This article takes {{article.readtime}} minute(s) to read.{% endif %}
    // This article takes 4 minute(s) to read.

.. code:: html

    {% if article.readtime_string %} This article takes {{article.readtime_string}} to read.{% endif %}
    // This article takes 4 minutes to read.

.. code:: html

    {% if article.readtime_with_seconds %}
      This article takes {{article.read_with_seconds[0]}} minutes(s) and {{article.read_with_seconds[1]}} second(s) to read.
    {% endif %}
    // This article takes 4 minutes and 21 second(s) to read.

.. code:: html

    {% if article.readtime_string_with_seconds %} This article takes {{article.readtime_string_with_seconds}} to read.{% endif %}
    // This article takes 4 minutes, 1 second to read.


Links
-----

.. _Pelican: http://getpelican.com/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JenkinsDev/pelican-readtime",
    "name": "pelican-readtime",
    "maintainer": "David Jenkins, Deepak Bhalla, Jonathan Dektiar",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "djenkinsdev@gmail.com, contact@deepakrb.com, contact@jonathandekhtiar.eu",
    "keywords": "pelican blogging blog static webdevelopment plugin pelican-plugin readtime python python3 python2",
    "author": "David Jenkins, Deepak Bhalla, Jonathan Dektiar",
    "author_email": "djenkinsdev@gmail.com, contact@deepakrb.com, contact@jonathandekhtiar.eu",
    "download_url": "https://files.pythonhosted.org/packages/d8/fc/a8384503aae7ac947ccf3a8fbe612a2d24ab1099e08ede64ae43ba3864eb/pelican_readtime-0.2.1.tar.gz",
    "platform": null,
    "description": "Readtime plugin for pelican\n===========================\n\n.. image:: https://travis-ci.com/JenkinsDev/pelican-readtime.svg?branch=master\n    :target: https://travis-ci.com/JenkinsDev/pelican-readtime\n\nPlugin for `Pelican`_ that computes a piece of content's read time.\n\nIt adds a ``readtime`` and ``readtime_string`` attributes to every\narticle and/or page, with the time estimation for reading the article.\n\nSetting Up\n----------\n\nAdding \u2018ReadTime\u2019 to the list of plugins:\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n**In pelicanconf.py:**\n\n.. code:: python\n\n    PLUGINS = [\n        ... ,\n        'readtime'\n    ]\n\n1. Words Per Minute Only\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nIn your settings you would use assign the ``READTIME_WPM`` variable to\nan integer like so:\n\n**In pelicanconf.py:**\n\n.. code:: python\n\n    READTIME_WPM = 180\n\nEvery article\u2019s read time would be calculated using this average words\nper minute count. (See the Usage section for how to use the calculated\nread times in templates). This is the simplest read time method.\n\n2. Words Per Minute per language\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis is the preferred method if you are dealing with multiple languages.\nTake a look at the following settings\n\n**In pelicanconf.py:**\n\n.. code:: python\n\n    READTIME_WPM = {\n        'default': {\n            'wpm': 200,\n            'min_singular': 'minute',\n            'min_plural': 'minutes',\n            'sec_singular': 'second',\n            'sec_plural': 'seconds'\n        },\n        'es': {\n            'wpm': 220,\n            'min_singular': 'minuto',\n            'min_plural': 'minutos',\n            'sec_singular': 'segundo',\n            'sec_plural': 'segundos'\n        }\n    }\n\nIn this example the default reading time for all articles is 200 words\nper minute. Any articles in spanish will be calculated at 220 wpm. This\nis useful for information dense languages where the read time varies\nrapidly.\n\nChances are the average reading time will not vary rapidly from language\nto language, however using this method also allows you to set plurals\nwhich make templating easier in the long run.\n\nUsage\n-----\n\nFour variables are accessible through the read time plugin:\n**readtime**, **readtime\\_string**, **readtime\\_with\\_seconds**, and **readtime\\_string\\_with\\_seconds**\n\n.. code:: html\n\n    {% if article.readtime %} This article takes {{article.readtime}} minute(s) to read.{% endif %}\n    // This article takes 4 minute(s) to read.\n\n.. code:: html\n\n    {% if article.readtime_string %} This article takes {{article.readtime_string}} to read.{% endif %}\n    // This article takes 4 minutes to read.\n\n.. code:: html\n\n    {% if article.readtime_with_seconds %}\n      This article takes {{article.read_with_seconds[0]}} minutes(s) and {{article.read_with_seconds[1]}} second(s) to read.\n    {% endif %}\n    // This article takes 4 minutes and 21 second(s) to read.\n\n.. code:: html\n\n    {% if article.readtime_string_with_seconds %} This article takes {{article.readtime_string_with_seconds}} to read.{% endif %}\n    // This article takes 4 minutes, 1 second to read.\n\n\nLinks\n-----\n\n.. _Pelican: http://getpelican.com/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Plugin for Pelican that computes average read time.",
    "version": "0.2.1",
    "project_urls": {
        "Download": "https://github.com/JenkinsDev/pelican-readtime",
        "Homepage": "https://github.com/JenkinsDev/pelican-readtime"
    },
    "split_keywords": [
        "pelican",
        "blogging",
        "blog",
        "static",
        "webdevelopment",
        "plugin",
        "pelican-plugin",
        "readtime",
        "python",
        "python3",
        "python2"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9586b8ad83fd38d6ac6736f5082e18b17d40c2f5c801e14ae4b05d3ff8a86e0f",
                "md5": "5a3ac8074c061261737f1442ee54ba21",
                "sha256": "22497c9dc83554f188d13af6a362d023b2c6e811af703553d99dfc404c52feec"
            },
            "downloads": -1,
            "filename": "pelican_readtime-0.2.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a3ac8074c061261737f1442ee54ba21",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 7196,
            "upload_time": "2024-11-20T19:40:13",
            "upload_time_iso_8601": "2024-11-20T19:40:13.299285Z",
            "url": "https://files.pythonhosted.org/packages/95/86/b8ad83fd38d6ac6736f5082e18b17d40c2f5c801e14ae4b05d3ff8a86e0f/pelican_readtime-0.2.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8fca8384503aae7ac947ccf3a8fbe612a2d24ab1099e08ede64ae43ba3864eb",
                "md5": "79963e74db9e9edc19bea5ee1d94f6be",
                "sha256": "d83fda594e05ba53ade767d1d702b79f2b1074a2f09eda69380b1ea32b71598a"
            },
            "downloads": -1,
            "filename": "pelican_readtime-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "79963e74db9e9edc19bea5ee1d94f6be",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7106,
            "upload_time": "2024-11-20T19:40:14",
            "upload_time_iso_8601": "2024-11-20T19:40:14.875074Z",
            "url": "https://files.pythonhosted.org/packages/d8/fc/a8384503aae7ac947ccf3a8fbe612a2d24ab1099e08ede64ae43ba3864eb/pelican_readtime-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 19:40:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JenkinsDev",
    "github_project": "pelican-readtime",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pelican-readtime"
}
        
Elapsed time: 0.40869s