Last active
January 2, 2016 02:59
-
-
Save ecarlisle/6a92bffc12b1a8b07961 to your computer and use it in GitHub Desktop.
This is an optimized version of Jekyll's /_includes/head.html include. Liquid variables are created up top to keep the source DRY and clean. Included in this header are Open Graph and Twitter meta tags for social integration.
Revision 8 Changes
Big thanks to @huphtur for the following edits:
- Clean up messy typos (d'oh!)
- Consolidate OG and Twitter meta tags as per post by @adactio on cleaning up metadata markup. See consolidations under "Social Meta Madness" content block.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Revision 3 Changes
Indentation Within {% capture %} Variable Assignment
Special thanks to @Phlow for changes made in revision 3. For readability, I added indentation for all variable assignments. I avoided this because the indentation whitespace gets included in the {% capture %} variable assignment block. Different numbers of whitespace characters are prepended and appended to the variable variable. The number of characters depends on the number of line breaks used in the {% capture %) block.
Strangely, this whitespace cannot be subsequently removed by the strip, lstrip, or rstrip string functions. I will file this as an issue if one has now already been created.
To space can be removed by using array functions. By splitting and rejoining the string using a space for the delimiter, the whitespace can be eliminated.
Avoiding verbose logic within markup.
This was another assist by @Phlow. I removed verbose chaining of functions within the markup (e.g. prepend | prepend | prepend | etc... ). I still do this in the variable assignment as it's more readable there, but try to maintain minimal logic within the markup.