Display Flickr images easily in your Pelican articles.
Project description
Pelican Flickr Tag
==================
Pelican Flickr Tag is a library to make it easy to display Flickr images in your Pelican_ blogs.
Installation
------------
To install the plugin, simply:
.. code-block:: bash
$ pip install pelican-flickrtag
Then add a bit of code to your blog configuration:
.. code-block:: python
PLUGINS = [
# ...
'pelican_flickrtag',
# ...
]
Usage
-----
In your articles, just add lines to your posts that look like:
.. code-block:: html
[flickr:id=5128831453]
This will tell the plugin to insert the image with id ``8152886277`` into your post. By default the resulting HTML will look like:
.. code-block:: html
<p class="caption-container">
<a class="caption" href="http://www.flickr.com/photos/chrisstreeter/5128831453/" target="_blank">
<img src="http://farm5.static.flickr.com/4037/5128831453_792359af82_z.jpg" alt="Sand Dunes" title="Sand Dunes" class="img-polaroid" />
</a>
<span class="caption-text muted">Sand Dunes</span>
</p>
If you want to change what the output looks like, you can create your own Jinja template and stick it in your theme directory. Then override the ``FLICKR_TAG_TEMPLATE_NAME`` setting to point to your template. See below for more information.
Settings
--------
``FLICKR_TAG_TEMPLATE_NAME`` - Specifies the name of the template to be used to render each replaced tag. This uses Pelican's template lookup to find the name of the template. If the template is named `flickrtag.html`, then this setting should be set to `flickrtag`. (Optional) The default template looks like:
..code-block:: html
<p class="caption-container">
<a class="caption" href="{{url}}" target="_blank">
<img src="{{raw_url}}"
alt="{{title}}"
title="{{title}}"
class="img-polaroid"
{% if FLICKR_TAG_INCLUDE_DIMENSIONS %}
width="{{width}}"
height="{{height}}"
{% endif %} />
</a>
<span class="caption-text muted">{{title}}</span>
</p>
``FLICKR_TAG_CACHE_LOCATION`` - The cache location which stores the looked up photo information. This dramatically speeds up building of the site and permits you to do it offline as well. Defaults to `/tmp/com.chrisstreeter.flickrtag-images.cache` (Optional)
``FLICKR_TAG_INCLUDE_DIMENSIONS`` - Whether to include the dimensions on the image tag generated by the template. Default is ``False``. (Optional)
``FLICKR_TAG_IMAGE_SIZE`` - The size alias used if ``FLICKR_TAG_INCLUDE_DIMENSIONS`` is set to ``True``. Default is 'Medium 640'. See the `Flickr getSizes documentation`_ for the valid values. (Optional)
Flickr Settings
---------------
The following two settings are required. In order to set them up, you will need to set up a Flickr API key. You can do this by `creating an app on Flickr`_. If the blog is a personal blog, then apply for a non-commercial key. Once you've got your key and secret, add them to your `Pelican configuration`_.
``FLICKR_API_KEY`` - The API key for your app to access the Flickr API. (Required)
``FLICKR_API_SECRET`` - The API secret for your app to access the Flickr API. (Required)
Flickr Tokens
-------------
A Flickr API token is only required if you want to access photos that are private to your account and cannot be gotten through the public API. I'll assume you know what you're doing and how to get a Flickr API token for this setting.
``FLICKR_API_TOKEN`` - The API token to access the Flickr API. (Optional)
Notes
-----
Uses portions of code from `flickrpy`_.
License
-------
Uses the `MIT`_ license.
.. _Pelican: http://blog.getpelican.com/
.. _`Pelican configuration`: http://docs.getpelican.com/en/latest/settings.html
.. _flickrpy: http://code.google.com/p/flickrpy
.. _MIT: http://opensource.org/licenses/MIT
.. _`creating an app on Flickr`: http://www.flickr.com/services/apps/create/apply/
.. _`Flickr getSizes documentation`: http://www.flickr.com/services/api/flickr.photos.getSizes.htm
==================
Pelican Flickr Tag is a library to make it easy to display Flickr images in your Pelican_ blogs.
Installation
------------
To install the plugin, simply:
.. code-block:: bash
$ pip install pelican-flickrtag
Then add a bit of code to your blog configuration:
.. code-block:: python
PLUGINS = [
# ...
'pelican_flickrtag',
# ...
]
Usage
-----
In your articles, just add lines to your posts that look like:
.. code-block:: html
[flickr:id=5128831453]
This will tell the plugin to insert the image with id ``8152886277`` into your post. By default the resulting HTML will look like:
.. code-block:: html
<p class="caption-container">
<a class="caption" href="http://www.flickr.com/photos/chrisstreeter/5128831453/" target="_blank">
<img src="http://farm5.static.flickr.com/4037/5128831453_792359af82_z.jpg" alt="Sand Dunes" title="Sand Dunes" class="img-polaroid" />
</a>
<span class="caption-text muted">Sand Dunes</span>
</p>
If you want to change what the output looks like, you can create your own Jinja template and stick it in your theme directory. Then override the ``FLICKR_TAG_TEMPLATE_NAME`` setting to point to your template. See below for more information.
Settings
--------
``FLICKR_TAG_TEMPLATE_NAME`` - Specifies the name of the template to be used to render each replaced tag. This uses Pelican's template lookup to find the name of the template. If the template is named `flickrtag.html`, then this setting should be set to `flickrtag`. (Optional) The default template looks like:
..code-block:: html
<p class="caption-container">
<a class="caption" href="{{url}}" target="_blank">
<img src="{{raw_url}}"
alt="{{title}}"
title="{{title}}"
class="img-polaroid"
{% if FLICKR_TAG_INCLUDE_DIMENSIONS %}
width="{{width}}"
height="{{height}}"
{% endif %} />
</a>
<span class="caption-text muted">{{title}}</span>
</p>
``FLICKR_TAG_CACHE_LOCATION`` - The cache location which stores the looked up photo information. This dramatically speeds up building of the site and permits you to do it offline as well. Defaults to `/tmp/com.chrisstreeter.flickrtag-images.cache` (Optional)
``FLICKR_TAG_INCLUDE_DIMENSIONS`` - Whether to include the dimensions on the image tag generated by the template. Default is ``False``. (Optional)
``FLICKR_TAG_IMAGE_SIZE`` - The size alias used if ``FLICKR_TAG_INCLUDE_DIMENSIONS`` is set to ``True``. Default is 'Medium 640'. See the `Flickr getSizes documentation`_ for the valid values. (Optional)
Flickr Settings
---------------
The following two settings are required. In order to set them up, you will need to set up a Flickr API key. You can do this by `creating an app on Flickr`_. If the blog is a personal blog, then apply for a non-commercial key. Once you've got your key and secret, add them to your `Pelican configuration`_.
``FLICKR_API_KEY`` - The API key for your app to access the Flickr API. (Required)
``FLICKR_API_SECRET`` - The API secret for your app to access the Flickr API. (Required)
Flickr Tokens
-------------
A Flickr API token is only required if you want to access photos that are private to your account and cannot be gotten through the public API. I'll assume you know what you're doing and how to get a Flickr API token for this setting.
``FLICKR_API_TOKEN`` - The API token to access the Flickr API. (Optional)
Notes
-----
Uses portions of code from `flickrpy`_.
License
-------
Uses the `MIT`_ license.
.. _Pelican: http://blog.getpelican.com/
.. _`Pelican configuration`: http://docs.getpelican.com/en/latest/settings.html
.. _flickrpy: http://code.google.com/p/flickrpy
.. _MIT: http://opensource.org/licenses/MIT
.. _`creating an app on Flickr`: http://www.flickr.com/services/apps/create/apply/
.. _`Flickr getSizes documentation`: http://www.flickr.com/services/api/flickr.photos.getSizes.htm
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pelican-flickrtag-0.3.2.tar.gz
(17.2 kB
view details)
File details
Details for the file pelican-flickrtag-0.3.2.tar.gz
.
File metadata
- Download URL: pelican-flickrtag-0.3.2.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36f7e5b794b0acdbf819ea5041951edde2ca4d1f51eaac9a5b834d8854bd4a23 |
|
MD5 | c6e8a37c57f49db9756da3621e02b2c6 |
|
BLAKE2b-256 | cb1e28ba209f186e66f619263dd7f5253a0636c071e76c12847babf4ce3e81f0 |