Skip to content

Commit

Permalink
add twitter feed
Browse files Browse the repository at this point in the history
  • Loading branch information
smth committed Aug 24, 2016
1 parent 1f1cb35 commit d923147
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 9 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ contact: [email protected]

googleanalytics: UA-48682838-7

twitter_feed: 730706209104384000

# Build settings
markdown: kramdown

Expand Down
7 changes: 7 additions & 0 deletions _includes/aside.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ <h4>News</h4>
{% endfor %}
</section>
{% endif %}

{% if site.twitter_feed %}
<section class="twitter-feed">
<h4>Twitter Feed</h4>
<div id="twitter"></div>
</section>
{% endif %}
25 changes: 21 additions & 4 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->

{% include header.html %}
<main class="cd-main-content">
{{ content }}
Expand All @@ -24,7 +24,7 @@
<li><a href="{{ site.baseurl }}/{{ item.slug }}/{{ subcategory.subslug }}/">{{ subcategory.subtitle }}</a></li>
{% endfor %}
</ul>

{% else %}
<li>
<a href="{{ site.baseurl }}/{{ item.slug }}">{{ item.title }}</a>
Expand All @@ -34,12 +34,29 @@
</ul>
{% include social-links.html %}
</nav>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.3.min.js"><\/script>')</script>
<script src="{{ "/js/plugins.js" | prepend: site.baseurl }}"></script>
<script src="{{ "/js/main.js" | prepend: site.baseurl }}"></script>

{% if page.aside == true and site.twitter_feed %}
<script src="{{ "/js/vendor/twitterFetcher_min.js" | prepend: site.baseurl }}"></script>
<script>
var configProfile = {
"id": '{{ site.twitter_feed }}',
"domId": 'twitter',
"maxTweets": 5,
"enableLinks": true,
"showUser": true,
"showTime": false,
"showImages": false,
"lang": 'en'
};
twitterFetcher.fetch(configProfile);
</script>
{% endif %}

{% if site.googleanalytics %}
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
Expand All @@ -51,4 +68,4 @@
</script>
{% endif %}
</body>
</html>
</html>
6 changes: 2 additions & 4 deletions _layouts/home.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
layout: default
aside: true
---
{% capture future_events %}{% for event in site.data.events %}{% if event.status == 'future' %}<h3><a href="{{ event.link }}">{{ event.title }}</a></h3><span>{{ event.description | truncate: 270 | markdownify }}</span><a href="{{ event.link }}">Join us!</a>@@{% endif %}{% endfor %}{% endcapture %}
{% assign future_e = future_events | split:"@@" %}

{% capture featured_events %}{% for event in site.data.events %}{% if event.status == 'featured' %}<h3><a href="{{ event.link }}">{{ event.title }}</a></h3><span>{{ event.description | truncate: 270 | markdownify }}</span><a href="{{ event.link }}">Join us!</a>@@{% endif %}{% endfor %}{% endcapture %}
{% assign featured_e = featured_events | split:"@@" %}


<div class="home">
<div class="banner">
<div class="wrapper">
Expand All @@ -17,7 +15,7 @@ <h1>{{ site.description }}</h1>
</span>
</div>
</div>
<div class="{% if layout.aside == true %}aside {% endif %}wrapper">
<div class="{% if page.aside == true %}aside {% endif %}wrapper">
<article>

<section>
Expand Down Expand Up @@ -48,7 +46,7 @@ <h3><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h3>
</section>

</article>
{% if layout.aside == true %}
{% if page.aside == true %}
<aside>
{% include aside.html %}
</aside>
Expand Down
72 changes: 71 additions & 1 deletion _sass/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ picture {
&.news-feed {
div {
padding-bottom: $small-spacing;
border-bottom: dotted 1px rgba($medium-gray, 0.5);
border-bottom: dotted 1px rgba($medium-gray, 0.3);

h5 {
font-size: 1.1em;
Expand All @@ -73,9 +73,79 @@ picture {
display: block;
line-height: 1.3;
margin-top: $small-spacing;
font-size: 0.8em;
}
}
}

&.twitter-feed {
font-size: 0.8em;

li {
border-bottom: dotted 1px rgba($medium-gray, 0.3);
margin-bottom: $small-spacing/2;
padding-top: $small-spacing/2;
padding-left: 40px;
}

.user {

a {
color: inherit;
font-weight: bold;

span {
&[data-scribe="element:screen_name"] {
color: rgba($medium-gray, 0.5);
font-weight: normal;
}
}
}

img {
width: 32px;
margin-left: -40px;
float: left;
border-radius: 3px;
display: block;
margin-top: 3px;
}
}

.tweet {
margin-bottom: $small-spacing/2;
word-break: break-word;
}

.interact {
a {
display: inline-block;
@include hide-text;
width: 16px;
height: 16px;
background-size: auto 14px;
background-repeat: no-repeat;
background-position: center;
margin-right: $small-spacing;
opacity: 0.4;

&.twitter_reply_icon {
background-image: url('../img/reply.svg');
}
&.twitter_retweet_icon {
background-image: url('../img/retweet.svg');
}
&.twitter_fav_icon {
background-image: url('../img/heart.svg');
}

&:hover {
opacity: 0.5;
}
}
}

}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions img/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions img/reply.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions img/retweet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: home
video: dJtx97kORFU
aside: true
---

## About the project
Expand Down
23 changes: 23 additions & 0 deletions js/vendor/twitterFetcher_min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d923147

Please sign in to comment.