1
0
Fork 0

added google analytics and next previous in category include

This commit is contained in:
Moritz »mo.« Sauer 2015-02-25 13:54:46 +01:00
parent 6636839e37
commit 3efde330dc
22 changed files with 151 additions and 63 deletions

View file

@ -1,8 +1,8 @@
{% comment %}
http://stackoverflow.com/questions/9612235/what-are-some-good-ways-to-implement-breadcrumbs-on-a-jekyll-site
https://github.com/huonw/huonw.github.io/blob/master/_layouts/default.html#L17
*
* http://stackoverflow.com/questions/9612235/what-are-some-good-ways-to-implement-breadcrumbs-on-a-jekyll-site
* https://github.com/huonw/huonw.github.io/blob/master/_layouts/default.html#L17
*
{% endcomment %}

View file

@ -69,7 +69,7 @@
<nav class="row">
<section id="subfooter-left" class="b30 small-12 medium-6 columns">
<ul class="inline-list">
<li>We &hearts; <a style="display:inline;" href="http://jekyllrb.com/" target="_blank">Jekyll</a> &amp; <a style="display:inline;" href="http://phlow.github.io/feeling-responsive/">Feeling Responsive</a> </li>
<li>Created with &hearts; by <a style="display:inline;" href="http://phlow.de/">Phlow</a> with <a style="display:inline;" href="http://jekyllrb.com/" target="_blank">Jekyll</a> using <a style="display:inline;" href="http://phlow.github.io/feeling-responsive/">Feeling Responsive</a> </li>
</ul>
</section>

View file

@ -1,9 +0,0 @@
<script src="{{ site.url }}/assets/js/javascript.min.js"></script>
{% if page.header.image_fullwidth %}
<script>
$("#masthead").backstretch("{{ site.url }}/images/{{ page.header.image_fullwidth }}", {fade: 700});
$("#masthead-with-text").backstretch("{{ site.url }}/images/{{ page.header.image_fullwidth }}", {fade: 700});
</script>
{% endif %}

24
_includes/footer_scripts.html Executable file
View file

@ -0,0 +1,24 @@
<script src="{{ site.url }}/assets/js/javascript.min.js"></script>
{% if page.header.image_fullwidth %}
<script>
$("#masthead").backstretch("{{ site.url }}/images/{{ page.header.image_fullwidth }}", {fade: 700});
$("#masthead-with-text").backstretch("{{ site.url }}/images/{{ page.header.image_fullwidth }}", {fade: 700});
</script>
{% endif %}
{% if site.google_analytics_tracking_id %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ if site.google_analytics_tracking_id }}', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
{% endif %}

View file

@ -1,23 +1,23 @@
{% comment %}
Possible parameter for this loop:
entries
offset
category
tag
Example for Category: {% include list-posts.html entries='3' offset='1' category='design' %}
Example for Tag: {% include list-posts.html entries='5' tag='terminal' %}
This loop works like this:
1. First we check if there was given a category for filtering if include.categories == NULL
2. If no category is given for filtering do a general loop.
3. If a category/tag was given, assign category/tag to the variable category/tag assign category = include.categories
*
* Possible parameter for this loop:
*
* entries
* offset
* category
* tag
*
* Example for Category: {% include list-posts.html entries='3' offset='1' category='design' %}
*
* Example for Tag: {% include list-posts.html entries='5' tag='terminal' %}
*
*
* This loop works like this:
*
* 1. First we check if there was given a category for filtering if include.categories == NULL
* 2. If no category is given for filtering do a general loop.
* 3. If a category/tag was given, assign category/tag to the variable category/tag assign category = include.categories
*
{% endcomment %}

View file

@ -0,0 +1,41 @@
{% comment %}
*
* This include creates a next/previous link to a post of the same category
* using a the categories-variable in front matter.
*
* Source: https://github.com/jekyll/jekyll/issues/260a#issue-495435
*
* Use  {% include next-previous-post-in-category.html %}
*
{% endcomment %}
{% comment %}
*
* assign FIRST category from categories variable from front matter to cat
* and make a string from the array by using  join: ''
*
{% endcomment %}
{% assign cat = page.categories | first | join: '' %}
{% for post in site.categories.[cat] %}
{% if post.url == page.url %}
{% assign post_index0 = forloop.index0 %}
{% assign post_index1 = forloop.index %}
{% endif %}
{% endfor %}
{% for post in site.categories.[cat] %}
{% if post_index0 == forloop.index %}
{% assign next_post = post.url %}
{% endif %}
{% if post_index1 == forloop.index0 %}
{% assign prev_post = post.url %}
{% endif %}
{% endfor %}
{% if next_post %}
<a class="left button tiny radius icon-chevron-left r15" href="{{ next_post }}">{{ site.data.language.next_post_in }} {{ cat | upcase }}</a>
{% endif %}
{% if prev_post %}
<a class="button tiny radius" href="{{ prev_post }}">{{ site.data.language.previous_post_in }} {{ cat | upcase }}<span class="icon-chevron-right"></span></a>
{% endif %}

View file

@ -1,9 +1,12 @@
<!-- This loops through the paginated posts
{% comment %}
* This loops through the paginated posts
*
* Total posts: {{ paginator.total_posts }}
* Total paginate-pages: {{ paginator.total_pages }}
*
{% endcomment %}
Total posts: {{ paginator.total_posts }}
Total paginate-pages: {{ paginator.total_pages }}
-->
{% for post in paginator.posts %}
<div class="row">
<div class="small-12 columns b60">

View file

@ -14,7 +14,7 @@
<div class="border-dotted radius b30">
<img src="http://placekitten.com/271/270" alt="uh, Placekitten">
<p class="text-left">
This is an advertisment with crazy cats! <a href="http://placekitten.com/">Check'em out.</a>
This is an advertisment with a crazy cat! <a href="http://placekitten.com/">More cats, please!</a>
</p>
</div>
</aside>