Getting rid of sass + adding <base href + adding image-process-thumb + styling mg-tag-filters + adding support for lang: tags

This commit is contained in:
Lucas Cimon 2017-08-15 01:39:41 +02:00
parent 8d5d7491bc
commit a3b1d218ad
15 changed files with 112 additions and 444 deletions

View File

@ -1,13 +0,0 @@
SCSSDIR ?= scss
CSSDIR = static/css
sass:
@for i in $$(ls $(SCSSDIR)); do \
out="$(CSSDIR)/$${i%.*}.css"; \
sass "$(SCSSDIR)/$$i" "$$out"; \
sed -i '$$d' "$$out"; \
rm "$$out.map"; \
done
@echo 'SCSS files compiled'

View File

@ -46,9 +46,9 @@ Features
Install
-------
This template uses the [representative_image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image) plugin, so you will need to:
This template uses the [representative_image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image) and [image_process](https://github.com/getpelican/pelican-plugins/tree/master/image_process) plugins, so you will need to:
pip install beautifulsoup4
pip install beautifulsoup4 pillow
Settings

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@ -1,247 +0,0 @@
$baseGreen: #39B39D;
$accentGreen: #28D1B2;
$feedOrange: #FF6600;
$twitterBlue: #00B0ED;
$facebookBlue: #3B5999;
$googleRed: #D34836;
$githubBlack: #333;
$mailBlue: #059;
$textGrey: #444;
$ancorBase: #33b5e5;
$ancorOver: #0099cc;
// Base style
html {
font: 400 14px / 20px "Oswald", "Helvetica Neue",Helvetica,Arial,sans-serif;
}
a {
color: $ancorBase;
&:hover {
color: $ancorOver;
}
}
// uikit override
.uk-navbar-brand {
text-transform: uppercase;
}
.uk-article-meta {
& > a {
color: $textGrey;
&:hover {
color: $textGrey;
}
}
& > .uk-icon-comment {
color: $textGrey;
}
}
.uk-icon-twitter {
color: $twitterBlue;
}
.uk-icon-facebook, .uk-icon-facebook-square {
color: $facebookBlue;
}
.uk-icon-google-plus, .uk-icon-google-plus-square {
color: $googleRed;
}
.uk-icon-github {
color: $githubBlack;
}
.uk-icon-envelope {
color: $textGrey;
}
.uk-nav-side > li.uk-active > a {
background: $accentGreen;
}
.uk-pagination>.uk-active>span {
background: $accentGreen;
}
.uk-icon-medium {
margin-right: 0.3em;
}
.uk-navbar-toggle {
color: white;
&:hover, &:focus {
color: white;
}
}
.uk-nav-offcanvas {
& > li > a {
border-top: 1px solid rgba(0,0,0,.3);
box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
text-shadow: 0 1px 0 rgba(0,0,0,.5);
&:last-child {
border-bottom: 1px solid rgba(0,0,0,.3);
}
}
& .uk-nav-divider {
border-top: 1px solid rgba(255,255,255,.01);
margin: 0;
height: 4px;
background: rgba(0,0,0,.2);
box-shadow: inset 0 1px 3px rgba(0,0,0,.3);
}
}
.uk-nav-offcanvas .uk-nav-header {
margin-top: 0;
background: #404040;
border-top: 1px solid rgba(0,0,0,.3);
box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
text-shadow: 0 1px 0 rgba(0,0,0,.5);
}
// mg style
.mg-header {
padding: 1em 0;
// Green style
background-color: $baseGreen;
}
.mg-brand {
font: {
family: "Open Sans", sans-serif;
style: italic;
size: 2.5em;
}
padding-left: 0;
// Green style
color: white;
text-decoration: none;
&:hover, &:focus {
color: white;
}
@media (max-width: 767px) {
padding: 0;
max-width: 100%;
font-size: 2em;
}
}
.mg-tagline {
font: {
family: "Open Sans", sans-serif;
weight: 800;
}
padding: 1em 0 0;
color: white;
@media (min-width: 1220px) {
padding-left: 0 !important;
}
}
.mg-main {
margin: {
top: 4em;
bottom: 3em;
}
min-height: 100%;
}
.mg-feed {
color: $feedOrange;
&:hover {
text-decoration: none;
color: $feedOrange;
}
}
.mg-list-title {
font-size: 2em;
line-height: 42px;
font-weight: 400;
text-transform: none;
margin-top: 0.5em;
}
.mg-footer {
margin-bottom: 1em;
}
.mg-author {
margin-top: 1em;
}
.mg-icon-link:hover {
text-decoration: none;
}
.mg-icons-small {
margin-bottom: 1em;
}
.mg-icons-small {
&>li>a {
color: white;
&:hover {
color: white;
}
}
.uk-icon-rss {
background-color: $feedOrange;
}
.uk-icon-twitter {
background-color: $twitterBlue;
}
.uk-icon-facebook {
background-color: $facebookBlue;
}
.uk-icon-google-plus {
background-color: $googleRed;
}
.uk-icon-github {
background-color: $githubBlack;
}
.uk-icon-envelope {
background-color: $mailBlue;
}
}
.mg-badges li {
float: left;
position: relative;
}
// Browser Upgrade
.browserupgrade {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}

View File

@ -1,127 +0,0 @@
/*!
* Tipue Search 4.0
* Copyright (c) 2014 Tipue
* Tipue Search is released under the MIT License
* http://www.tipue.com/search
*
* This is a modified version of the Tipue Search plugin style sheet,
* edited for the pelican mg theme.
* If you are looking for the original Tipue Search plugin style sheet
* check the project home at http://www.tipue.com/search.
*/
$baseText: #444;
@mixin animation($values) {
-webkit-animation: $values;
-moz-animation: $values;
-o-animation: $values;
animation: $values;
}
#tipue_search_content {
max-width: 650px;
padding-top: 15px;
margin: 0;
}
#tipue_search_loading:before {
padding-top: 60px;
font-family: FontAwesome;
content: "\f013";
background: #fff no-repeat left;
@include animation(fa-spin 2s infinite linear);
}
#tipue_search_warning_head {
font: 300 15px/1.6;
color: #555;
}
#tipue_search_warning {
font: 300 13px/1.6;
color: #333;
margin: 7px 0;
}
#tipue_search_warning a {
color: #36c;
font-weight: 300;
text-decoration: none;
}
#tipue_search_warning a:hover {
color: #333;
}
.tipue_search_content_title {
font-size: 2em;
line-height: 42px;
font-weight: 400;
text-transform: none;
margin-top: 0.5em;
}
.tipue_search_content_title a {
color: $baseText;
text-decoration: none;
&:hover {
color: $baseText;
text-decoration: underline;
}
}
.tipue_search_content_url {
display: none;
}
.tipue_search_content_text {
margin-top: 3px;
}
.h01 {
font-weight: bold;
}
#tipue_search_foot {
margin: 51px 0 21px 0;
}
#tipue_search_foot_boxes {
font-size: 0.75em;
padding: 0;
margin: 0;
}
#tipue_search_foot_boxes li {
list-style: none;
margin: 0;
padding: 0;
display: inline;
}
#tipue_search_foot_boxes li a {
padding: 9px 15px 10px 15px;
background-color: #f1f1f1;
border: 1px solid #dcdcdc;
border-radius: 1px;
color: #333;
margin-right: 7px;
text-decoration: none;
text-align: center;
}
#tipue_search_foot_boxes li.current {
padding: 9px 15px 10px 15px;
background: #fff;
border: 1px solid #dcdcdc;
border-radius: 1px;
color: #333;
margin-right: 7px;
text-align: center;
}
#tipue_search_foot_boxes li a:hover {
border: 1px solid #ccc;
background-color: #f3f3f3;
}

View File

@ -125,10 +125,17 @@ a {
font: inherit;
padding: .5rem 1.5rem;
margin: .5rem 1rem;
text-transform: uppercase; }
.mg-tag-filter:hover {
border-color: #b2b2b2;
text-decoration: none;}
text-transform: uppercase;
cursor: pointer; }
.mg-tag-filter:hover {
border-color: #b2b2b2;
text-decoration: none; }
.mg-tag-filter-enabled {
background-color: #33b5e5;
border-color: black; }
.mg-tag-filter-disabled {
background-color: #FF9148;
border-color: black; }
.mg-nav-small {
width: 100% }
@ -268,3 +275,13 @@ a {
.mg-cloud-tag-badge {
color: #FF6600; }
.mg-fadeable {
max-height: 100vh;
overflow: hidden;
transition: max-height 1s ease-in;
}
.mg-faded {
max-height: 0;
transition: max-height 1s ease-out;
}

View File

@ -16,50 +16,54 @@
<!--[if gt IE 8]><!--> <html lang="{{ DEFAULT_LANG }}" class="no-js" prefix="og: http://ogp.me/ns#" itemscope itemtype="http://schema.org/Blog"> <!--<![endif]-->
{% endif %}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% block title %}{{ SITENAME }}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{% block description %}{{ DESCRIPTION }}{% endblock %}">
{% if FAVICON %}<link rel="shortcut icon" href="{{ SITEURL }}/{{ FAVICON }}" type="{{ FAVICON_TYPE|default('image/x-icon') }}">{% endif %}
<meta name="author" content="{{ AUTHOR }}">
<meta name="copyright" content="{{ AUTHOR }}">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{ TWITTER_USERNAME }}" />
<meta property="og:site_name" content="{{ SITENAME }}" />
{% block seo %}
<meta property="og:title" content="{{ SITENAME }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}" />
<meta name="twitter:url" content="{{ SITEURL }}" />
<meta itemprop="name" content="{{ SITENAME }}" />
<meta itemprop="url" content="{{ SITEURL }}"/>
{% if DESCRIPTION %}
<meta property="og:description" content="{{ DESCRIPTION }}" />
<meta name="twitter:description" content="{{ DESCRIPTION }}" />
<meta itemprop="description" content="{{ DESCRIPTION }}" />
{% endif %}
{% if META_IMAGE %}
<meta property="og:image" content="{{ META_IMAGE }}" />
<meta property="og:image:type" content="{{ META_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ META_IMAGE }}" />
<meta itemprop="image" content="{{ META_IMAGE }}" />
{% endif %}
{% endblock %}
<link href="{{ SITEURL }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} ATOM Feed"/>
<link href='{{ SITEURL }}/theme/css/uikit-2.27.4.min.css' rel='stylesheet' type='text/css'>
{% if not DISABLE_SEARCH %}
<link href='{{ SITEURL }}/theme/css/uikit-2.27.4-search.min.css' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/tipuesearch.css">
{% endif %}
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/solarized-highlight.css">
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/main.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="{{ SITEURL }}">
<title>{% block title %}{{ SITENAME }}{% endblock %}</title>
<meta name="description" content="{% block description %}{{ DESCRIPTION }}{% endblock %}">
{% if FAVICON %}<link rel="shortcut icon" href="{{ SITEURL }}/{{ FAVICON }}" type="{{ FAVICON_TYPE|default('image/x-icon') }}">{% endif %}
<link href="{{ SITEURL }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} ATOM Feed"/>
<meta name="author" content="{{ AUTHOR }}">
<meta name="copyright" content="{{ AUTHOR }}">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{ TWITTER_USERNAME }}" />
<meta property="og:site_name" content="{{ SITENAME }}" />
{% block seo %}
<meta property="og:title" content="{{ SITENAME }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ SITEURL }}" />
<meta name="twitter:url" content="{{ SITEURL }}" />
<meta itemprop="name" content="{{ SITENAME }}" />
<meta itemprop="url" content="{{ SITEURL }}"/>
{% if DESCRIPTION %}
<meta property="og:description" content="{{ DESCRIPTION }}" />
<meta name="twitter:description" content="{{ DESCRIPTION }}" />
<meta itemprop="description" content="{{ DESCRIPTION }}" />
{% endif %}
{% if META_IMAGE %}
<meta property="og:image" content="{{ META_IMAGE }}" />
<meta property="og:image:type" content="{{ META_IMAGE_TYPE }}" />
<meta name="twitter:image" content="{{ META_IMAGE }}" />
<meta itemprop="image" content="{{ META_IMAGE }}" />
{% endif %}
{% endblock %}
<link href='{{ SITEURL }}/theme/css/uikit-2.27.4.min.css' rel='stylesheet' type='text/css'>
{% if not DISABLE_SEARCH %}
<link href='{{ SITEURL }}/theme/css/uikit-2.27.4-search.min.css' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/tipuesearch.css">
{% endif %}
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/solarized-highlight.css">
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/main.css">
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<header class="mg-header uk-navbar uk-navbar-attached">
@ -249,6 +253,7 @@
<script src="{{ SITEURL }}/theme/js/html5shiv-3.7.2.min.js"></script>
<script src="{{ SITEURL }}/theme/js/jquery-1.10.2.min.js"></script>
<script src="{{ SITEURL }}/theme/js/uikit-2.27.4.min.js"></script>
{% if not DISABLE_SEARCH %}
<script src="{{ SITEURL }}/theme/js/uikit-2.27.4-search.min.js"></script>
<script src="{{ SITEURL }}/theme/js/tipuesearch_set.js"></script>
@ -257,12 +262,14 @@
{% include 'js/enable-search.js' %}
</script>
{% endif %}
{% if SHARE %}
<script src="{{ SITEURL }}/theme/js/jquery.sticky-kit.js"></script>
<script>
{% include 'js/social.js' %}
</script>
{% endif %}
{% if MG_FILTER_TAGS %}
<script>
{% include 'js/filter-tags.js' %}

View File

@ -3,9 +3,12 @@
{% block content_title %}{% endblock %}
{% block header_extra %}
{% if MG_LANG_FILTER_TAGS %}
<button class="mg-tag-filter" onclick='toggleLangTagFilter.bind(this)({{ MG_LANG_FILTER_TAGS|tojson }})'>lang</button>
{% endif %}
{% if MG_FILTER_TAGS %}
{% for filter_tag in MG_FILTER_TAGS %}
<button class="mg-tag-filter" onclick="toggleTagFilter('{{ filter_tag }}')">{{ filter_tag.replace('lang:', '') }}</button>
<button class="mg-tag-filter" onclick="toggleTagFilter.bind(this)('{{ filter_tag }}')">{{ filter_tag.replace('lang:', '') }}</button>
{% endfor %}
{% endif %}
{% endblock %}

View File

@ -6,19 +6,49 @@
* */
window.tagFilters = {}
function indexOf(array, predicate) {
for (var i = 0; i < array.length; i++) if (predicate(array[i])) return array[i];
}
function startsWith(searchString, position) {
position = position || 0;
return this.substr(position, searchString.length) === searchString;
};
function toggleTagFilter(tag) {
var filterState = window.tagFilters[tag]
if (filterState === true) {
this.classList.remove('mg-tag-filter-enabled');
filterState = false;
this.classList.add('mg-tag-filter-disabled');
} else if (filterState === false) {
this.classList.remove('mg-tag-filter-disabled');
filterState = undefined;
} else {
filterState = true;
this.classList.add('mg-tag-filter-enabled');
}
window.tagFilters[tag] = filterState;
updateArticlesVisibility();
}
function toggleLangTagFilter(langs) {
var lang = this.textContent;
if (lang === 'lang') {
lang = langs[0];
window.tagFilters['lang:'+lang] = true;
} else {
window.tagFilters['lang:'+lang] = undefined;
lang = langs[langs.indexOf(lang) + 1];
if (typeof lang === 'undefined') {
lang = 'lang'
} else {
window.tagFilters['lang:'+lang] = true;
}
}
this.textContent = lang;
updateArticlesVisibility();
}
function updateArticlesVisibility() {
var anyTrueFilter = Object.keys(window.tagFilters).some(function (tagFilter) {
return !!window.tagFilters[tagFilter];
@ -38,9 +68,9 @@ function updateArticlesVisibility() {
}
if (shouldDisplay) {
article.classList.remove('uk-hidden');
article.classList.remove('mg-faded');
} else {
article.classList.add('uk-hidden');
article.classList.add('mg-faded');
}
});
}

View File

@ -1,8 +1,8 @@
<article class="uk-article" itemtype="http://schema.org/BlogPosting" itemscope="itemscope" itemprop="blogPost"
<article class="uk-article mg-fadeable" itemtype="http://schema.org/BlogPosting" itemscope="itemscope" itemprop="blogPost"
data-tags='{{ article.tags|map(attribute='name')|list|tojson }}'>
<div class="mg-article-short">
{% if article.featured_image %}
<img class="mg-article-image" src="{{ article.featured_image }}" alt="">
<img class="mg-article-image image-process-thumb" src="{{ article.featured_image }}" alt="">
{% endif %}
<div class="mg-article-content">
<a href="{{ SITEURL }}/{{ article.url }}" class="uk-link-muted"><h1 class="uk-article-title" itemprop="name">{{ article.title|e }}</h1></a>

View File

@ -1,16 +1,14 @@
{
"pages": [
{% set len = (articles + pages)| length %}
{% set comma = joiner(',') %}
{% for item in articles + pages %}
{{comma()}}
{
"title": "{{item.title|striptags|e}}",
"text":"{{item.content|striptags|e}}",
"tags": "{{item.category}}",
"tags": "{{item.tags}}",
"loc": "{{ SITEURL }}/{{item.url}}"
}{% if loop.index < len %},
{% else %}
{% endif %}
}
{% endfor %}
]
}