Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Twitter account and optimizing sharing links for Twitter and FB #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ form:
validate:
type: text
help: Enable or disable the twitter button

buttons.twitter.account:
type: text
label: Twitter button account
highlight: 1
validate:
type: text
help: Twitter account name

buttons.googleplus.enabled:
type: toggle
Expand Down
1 change: 1 addition & 0 deletions socialbuttons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buttons:
twitter:
enabled: true
label: Twitter
account:
googleplus:
enabled: true
label: Google+
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/_facebook.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class="rrssb-facebook">
<a href="https://www.facebook.com/sharer/sharer.php?u={{ page_url }}" class="popup">
<a href="https://www.facebook.com/sharer/sharer.php?u={{ page_url }}&t={{ title }}" class="popup">
<span class="rrssb-icon">
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="29" height="29" viewBox="0 0 29 29">
<path d="M26.4 0H2.6C1.714 0 0 1.715 0 2.6v23.8c0 .884 1.715 2.6 2.6 2.6h12.393V17.988h-3.996v-3.98h3.997v-3.062c0-3.746 2.835-5.97 6.177-5.97 1.6 0 2.444.173 2.845.226v3.792H21.18c-1.817 0-2.156.9-2.156 2.168v2.847h5.045l-.66 3.978h-4.386V29H26.4c.884 0 2.6-1.716 2.6-2.6V2.6c0-.885-1.716-2.6-2.6-2.6z"
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/_twitter.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<li class="rrssb-twitter">
<!-- Replace href with your Meta and URL information -->
<a href="https://twitter.com/intent/tweet?url={{ page_url }}&text={{ title }}"
<a href="https://twitter.com/intent/tweet?text={{ title }}&url={{ page_url }}&via={{ account }}&hashtags={{ tags }}"
class="popup">
<span class="rrssb-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">
Expand Down
17 changes: 14 additions & 3 deletions templates/partials/socialbuttons.html.twig
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
<ul class="rrssb-buttons clearfix">
{% set page_url = socialbuttons_domain ~ url %}
{% set title = page.title %}

{% set tags = '' %}
{% for tag in page.taxonomy.tag %}
{% set tags = tags ~ tag %}
{% if not loop.last %}
{% set tags = tags ~ ',' %}
{% endif %}
{% endfor %}

{% for name, values in socialbuttons_buttons %}
{% if values.enabled %}
{% set account = (values.account is defined) ? values.account %}

{% if values.enabled %}
{% include 'partials/_' ~ name ~ '.html.twig' with {'label': values.label} %}
{% endif %}
{% include 'partials/_' ~ name ~ '.html.twig' with {'label': values.label, 'title': title, 'account': account, 'tags': tags} %}
{% endif %}
{% endfor %}
</ul>