Fix #1121 Add reddit to share post plugin

This commit is contained in:
Paolo Melchiorre 2019-04-17 08:46:36 +02:00 committed by Justin Mayer
commit d1c511e038
3 changed files with 55 additions and 50 deletions

View file

@ -1,8 +1,9 @@
Share Post
==========
# Share Post
A Pelican plugin to create share URLs of article
# Author
Copyright (c) Talha Mansoor
Author | Talha Mansoor
@ -11,11 +12,12 @@ Author Email | talha131@gmail.com
Author Homepage | http://onCrashReboot.com
Github Account | https://github.com/talha131
## Contributors:
* [Jonathan DEKHTIAR](https://github.com/DEKHTIARJonathan) - contact@jonathandekhtiar.eu
### Contributors
Why do you need it?
===================
* [Jonathan DEKHTIAR](https://github.com/DEKHTIARJonathan) - contact@jonathandekhtiar.eu
* [Paolo Melchiorre](https://github.com/pauloxnet) - [www.paulox.net](https://www.paulox.net/)
## Why do you need it?
Almost all website have share widgets to let readers share posts on social
networks. Most of these widgets are used by vendors for online tracking. These
@ -26,8 +28,7 @@ affect readers attention.
can use. These links do not have the ability to track the users. They can also
be unobtrusive depending on how Pelican theme uses them.
Requirements
============
## Requirements
`share_post` requires BeautifulSoup
@ -35,8 +36,7 @@ Requirements
pip install beautifulsoup4
```
How to Use
==========
## How to Use
`share_post` adds a dictionary attribute to `article` which can be accessed via
`article.share_post`. Keys of the dictionary are as follows,
@ -47,28 +47,29 @@ How to Use
1. `diaspora`
1. `linkedin`
1. `hacker-news`
1. `reddit`
Template Example
================
## Template Example
```python
```html
{% if article.share_post and article.status != 'draft' %}
<section>
<p id="post-share-links">
Share on:
<a href="{{article.share_post['diaspora']}}" target="_blank" title="Share on Diaspora">Diaspora*</a>
<a href="{{article.share_post['twitter']}}" target="_blank" title="Share on Twitter">Twitter</a>
<a href="{{article.share_post['facebook']}}" target="_blank" title="Share on Facebook">Facebook</a>
<a href="{{article.share_post['linkedin']}}" target="_blank" title="Share on LinkedIn">LinkedIn</a>
<a href="{{article.share_post['hacker-news']}}" target="_blank" title="Share on HackerNews">HackerNews</a>
<a href="{{article.share_post['email']}}" target="_blank" title="Share via Email">Email</a>
</p>
<p id="post-share-links">
Share on:
<a href="{{article.share_post['diaspora']}}" target="_blank" title="Share on Diaspora">Diaspora*</a>
<a href="{{article.share_post['twitter']}}" target="_blank" title="Share on Twitter">Twitter</a>
<a href="{{article.share_post['facebook']}}" target="_blank" title="Share on Facebook">Facebook</a>
<a href="{{article.share_post['linkedin']}}" target="_blank" title="Share on LinkedIn">LinkedIn</a>
<a href="{{article.share_post['hacker-news']}}" target="_blank" title="Share on HackerNews">HackerNews</a>
<a href="{{article.share_post['email']}}" target="_blank" title="Share via Email">Email</a>
<a href="{{article.share_post['reddit']}}" target="_blank" title="Share via Reddit">Reddit</a>
</p>
</section>
{% endif %}
```