Add absolute urls to open graph and twitter cards. Added dev yml config file. Only include analytics in production environment.

pull/56/head
Glen Cheney 11 years ago
parent 551f848377
commit 8e7c98c012

@ -8,7 +8,12 @@ Categorize, sort, and filter a responsive grid of items
This is a large improvement to shuffle. Most notably, the ability for [masonry](http://masonry.desandro.com) layouts. Other additions include adding/removing items, enabling/disabling, multiple instances on a page, and more!
## Running locally
This project uses [Jekyll](http://jekyllrb.com/), so head over to [their quickstart guide](http://jekyllrb.com/docs/quickstart/) to get set up. You should then be able to run `jekyll serve --watch` and go to `http://localhost:4000/Shuffle` to see it.
This project uses [Jekyll](http://jekyllrb.com/), so:
* head over to [their quickstart guide](http://jekyllrb.com/docs/quickstart/) to setup jekyll.
* run `jekyll serve --watch --config _config.yml,_config_dev.yml` in your console
* go to `http://localhost:4000` to see it.
The `--config` option can take multiple config files. In this case, the `_config_dev.yml` file overrides options set in `_config.yml`.
## Improvements still to make
* Use Deferred objects for callbacks

@ -7,14 +7,18 @@ exclude: ['./_scss/*.*']
permalink: /:title
# url: http://glen.local:4000
# url: http://localhost:4000
# url: http://vestride.github.io/Shuffle
# Overriden in _config_dev.yml
environment: production
# Open graph and twitter cards require absolute urls
url: http://vestride.github.io
# jekyll serve --watch --config _config.yml,_config_dev.yml
baseurl: /Shuffle
defaultTitle: 'Shuffle.js'
defaultDescription: 'Categorize, sort, and filter a responsive grid of items'
defaultImage: '/img/hero.png'
defaultImage: '/img/shuffle.png'
longDescription: 'Shuffle.js is a jQuery plugin for sorting, filtering, and laying out a group of items. It’s performant, responsive, and fast. Check out the demos!'

@ -0,0 +1,6 @@
# Options in this file override ones set in _config.yml
environment: "development"
url: http://localhost:4000
baseurl: ""

@ -9,12 +9,11 @@
{% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ site.defaultDescription }}{% endif %}{% endcapture %}
{% capture image %}{% if page.image %}{{ page.image }}{% else %}{{ site.defaultImage }}{% endif %}{% endcapture %}
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="{{ page.title }}" />
<meta property="og:description" content="{{ description }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ site.baseurl }}{{ page.url }}" />
<meta property="og:image" content="{{ site.baseurl }}{{ image }}" />
<meta property="og:url" content="{{ site.url }}{{ site.baseurl }}{{ page.url }}" />
<meta property="og:image" content="{{ site.url }}{{ site.baseurl }}{{ image }}" />
<meta property="og:site_name" content="" />
<meta property="fb:admins" content="771347349" />
<meta name="author" content="https://plus.google.com/u/0/100210640453700033824" />
@ -22,7 +21,7 @@
<meta name="twitter:creator" content="@Vestride">
<meta name="twitter:title" content="{{ page.title }}">
<meta name="twitter:description" content="{{ description }}">
<meta name="twitter:image" content="{{ site.baseurl }}{{ image }}">
<meta name="twitter:image" content="{{ site.url }}{{ site.baseurl }}{{ image }}">
<link href="https://plus.google.com/u/0/100210640453700033824" rel="author" />

@ -20,4 +20,32 @@
{% for src in page.extraJS %}
<script src="{{ site.baseurl }}/js/{{ src }}"></script>
{% endfor %}
{% endif %}
{% if site.environment == "production" %}
<script>
// Analytics
var _gaq = [ ['_setAccount', 'UA-39355642-1'], ['_trackPageview'] ];
(function(doc, script) {
'use strict';
var js,
fjs = doc.scripts[0],
frag = doc.createDocumentFragment(),
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
if ( id ) { js.id = id; }
frag.appendChild( js );
};
// Load GA over http, we know it won't be over ssl
add('//www.google-analytics.com/ga.js');
fjs.parentNode.insertBefore(frag, fjs);
}(document, 'script'));
</script>
{% endif %}

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -366,32 +366,6 @@ Modules.Favicon = (function( doc ) {
}( document ));
// Analytics
var _gaq = [ ['_setAccount', 'UA-39355642-1'], ['_trackPageview'] ];
(function(doc, script) {
'use strict';
var js,
fjs = doc.scripts[0],
frag = doc.createDocumentFragment(),
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
if ( id ) { js.id = id; }
frag.appendChild( js );
};
// Load GA over http, we know it won't be over ssl
add('//www.google-analytics.com/ga.js');
fjs.parentNode.insertBefore(frag, fjs);
}(document, 'script'));
$(document).ready(function() {
'use strict';

Loading…
Cancel
Save