-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7c671f
commit 5151143
Showing
6 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
twitter_format: "@title: @url@tags" | ||
twitter_url_length: 22 | ||
twitter_max_length: 140 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
layout: social-feed | ||
--- | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> | ||
<channel> | ||
<title>{{ site.blog_title | xml_escape }}</title> | ||
<description>{{ site.blog_description | xml_escape }}</description> | ||
<link>{{ site.site_url }}{{ site.blog_url }}</link> | ||
<atom:link href="{{ "/feed.xml" | prepend: site.blog_url | prepend: site.site_url }}" rel="self" type="application/rss+xml" /> | ||
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate> | ||
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate> | ||
<generator>Jekyll v{{ jekyll.version }}</generator> | ||
{% assign site.twitter_format = "@title: @url@tags" %} | ||
{% assign site.site.twitter_url_length = 22 %} | ||
{% assign twitter_max_length = 140 %} | ||
|
||
{% assign platform = page.title | downcase %} | ||
|
||
{% for post in site.posts limit:10 %} | ||
{% assign share_on = post.share | downcase %} | ||
|
||
{% if share_on contains '--twitter-hashtags' %} | ||
{% assign format_parsed = site.twitter_format | replace: '@title', post.title | replace: '@url', '' | replace: '@tags', '' | size %} | ||
{% assign post_tags = '' %} | ||
{% assign space_left = site.twitter_max_length | minus: format_parsed.size %} | ||
|
||
{% if site.twitter_format contains '@url' %} | ||
{% assign space_left = space_left | minus: site.twitter_url_length %} | ||
{% endif %} | ||
|
||
{% for tag in post.tags %} | ||
{% capture new_tag %} #{{ tag }}{% endcapture %} | ||
{% assign new_space_left = space_left | minus: new_tag.size %} | ||
|
||
{% if new_space_left > 0 %} | ||
{% assign post_tags = post_tags | append: new_tag %} | ||
{% assign space_left = space_left | minus: new_tag.size %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% assign post_title = site.twitter_format | replace: '@title', post.title | replace: '@tags', post_tags | replace: '@url', post.url %} | ||
{% else %} | ||
{% assign post_title = post.title %} | ||
{% endif %} | ||
|
||
{% if share_on contains platform %} | ||
<item> | ||
<title>{{ post_title | xml_escape }}</title> | ||
<description>{{ post.content | xml_escape }}</description> | ||
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate> | ||
<link>{{ post.url | prepend: site.site_url }}</link> | ||
<guid isPermaLink="true">{{ post.url | prepend: site.site_url }}</guid> | ||
{% for tag in post.tags %} | ||
<category>{{ tag | xml_escape }}</category> | ||
{% endfor %} | ||
{% for cat in post.categories %} | ||
<category>{{ cat | xml_escape }}</category> | ||
{% endfor %} | ||
</item> | ||
{% endif %} | ||
{% endfor %} | ||
</channel> | ||
</rss> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
layout: post | ||
title: "Example post" | ||
date: 2015-04-28 09:32:00 | ||
categories: blog | ||
tags: jekyll social example post | ||
share: twitter --twitter-hashtags facebook linkedin | ||
--- | ||
Hello world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
layout: social-feed | ||
title: Facebook | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
layout: social-feed | ||
title: LinkedIn | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
layout: null | ||
--- | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> | ||
<channel> | ||
<title>{{ site.blog_title | xml_escape }}</title> | ||
<description>{{ site.blog_description | xml_escape }}</description> | ||
<link>{{ site.site_url }}{{ site.blog_url }}</link> | ||
<atom:link href="{{ "/feed.xml" | prepend: site.blog_url | prepend: site.site_url }}" rel="self" type="application/rss+xml" /> | ||
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate> | ||
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate> | ||
<generator>Jekyll v{{ jekyll.version }}</generator> | ||
{% assign platform = 'twitter' %} | ||
|
||
{% for post in site.posts limit:10 %} | ||
{% assign share_on = post.share | downcase %} | ||
|
||
{% if share_on contains '--twitter-hashtags' %} | ||
{% assign format_parsed = site.twitter_format | replace: '@title', post.title | replace: '@url', '' | replace: '@tags', '' | size %} | ||
{% assign post_tags = '' %} | ||
{% assign space_left = site.twitter_max_length | minus: format_parsed.size %} | ||
|
||
{% if site.twitter_format contains '@url' %} | ||
{% assign space_left = space_left | minus: site.twitter_url_length %} | ||
{% endif %} | ||
|
||
{% for tag in post.tags %} | ||
{% capture new_tag %} #{{ tag }}{% endcapture %} | ||
{% assign new_space_left = space_left | minus: new_tag.size %} | ||
|
||
{% if new_space_left > 0 %} | ||
{% assign post_tags = post_tags | append: new_tag %} | ||
{% assign space_left = space_left | minus: new_tag.size %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% assign post_title = site.twitter_format | replace: '@title', post.title | replace: '@tags', post_tags | replace: '@url', post.url %} | ||
{% else %} | ||
{% assign post_title = post.title %} | ||
{% endif %} | ||
|
||
{% if share_on contains platform %} | ||
<item> | ||
<title>{{ post_title | xml_escape }}</title> | ||
<description>{{ post.content | xml_escape }}</description> | ||
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate> | ||
<link>{{ post.url | prepend: site.site_url }}</link> | ||
<guid isPermaLink="true">{{ post.url | prepend: site.site_url }}</guid> | ||
{% for tag in post.tags %} | ||
<category>{{ tag | xml_escape }}</category> | ||
{% endfor %} | ||
{% for cat in post.categories %} | ||
<category>{{ cat | xml_escape }}</category> | ||
{% endfor %} | ||
</item> | ||
{% endif %} | ||
{% endfor %} | ||
</channel> | ||
</rss> |