From d6e5707e75f7d83e1b38eb308272355ae4434d35 Mon Sep 17 00:00:00 2001 From: Lucas Cimon Date: Sun, 13 Aug 2017 20:36:09 +0200 Subject: [PATCH] Adding representative_image --- .pre-commit-config.yaml | 2 +- README.md | 18 ++++++++++++++---- static/css/main.css | 22 ++++++++++++++++++++++ templates/base.html | 4 ++-- templates/partials/article-short.html | 23 +++++++++++++++-------- templates/partials/inline-tags.html | 2 +- 6 files changed, 55 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2cfe7b0..8d43271 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ exclude: npp/.*\.xml - id: remove-tabs - repo: https://github.com/Lucas-C/pre-commit-hooks-html - sha: v1.2.1 + sha: v1.3.1 hooks: - id: validate-html args: diff --git a/README.md b/README.md index 494bf6c..b6cb2ed 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ mg ============== A minimal theme for [Pelican](http://blog.getpelican.com/) that uses uikit. -The theme is suited for a single author blog without tag pages nor -blogroll. Feeds are provided via ATOM. +The theme is suited for a single author blog. Feeds are provided via ATOM. Screenshots @@ -28,7 +27,7 @@ This is the article layout on a smartphone screen Live Example -------------- -Check out [my blog](http://www.devsbytes.com). +Check out [my blog](https://chezsoi.org/lucas). Features -------------- @@ -38,11 +37,19 @@ Features * [Schema.org](http://schema.org) support. * Search with [Tipue Search](http://www.tipue.com/search). * Responsive design. -* Comment with DISQUS. +* Comment with DISQUS or inno * SCSS style sheets. * Analytics with Google Analytics, PIWIK and StatCounter. * Share buttons built with share urls. * Custom footer notice. +* W3C-Validatated HTML + +Install +------- +This template uses the [representative_image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image) plugin, so you will need to: + + pip install beautifulsoup4 + Settings -------------- @@ -117,6 +124,9 @@ e.g. ('envelope', 'mailto:luca92web@gmail.com'),) ``` +**MG_DISABLE_SUMMARY** +If you do not manually provide a summary on your articles, set this to `True` so that that the articles summary is not included on the index / search result pages. + Example Configuration ---------------------- diff --git a/static/css/main.css b/static/css/main.css index dd35963..dc243fd 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -105,12 +105,34 @@ a { margin-bottom: 3em; min-height: 100%; } +.mg-article-short { + display: flex; + align-items: center; + flex-wrap: wrap; } + article:nth-child(even) > .mg-article-short { + flex-direction: row-reverse; } +.mg-article-image { + flex: 1 1 15rem; + min-height: 0; /* required for flexbox shrink to work properly - Chrome 60 */ + min-width: 0; /* required for flexbox shrink to work properly - Chrome 60 */ + max-height: 50%; + max-width: 50%; + padding: 1rem; + margin: 0 auto; + width: 100%; + height: 100%; + object-fit: contain; } +.mg-article-content { + flex: 3 1 35rem; } + .mg-feed { color: #FF6600; } .mg-feed:hover { text-decoration: none; color: #FF6600; } +.mg-tags { + text-align: right; } .mg-tag { margin: 0 .5rem; font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; diff --git a/templates/base.html b/templates/base.html index a2ae6ac..a297cd1 100644 --- a/templates/base.html +++ b/templates/base.html @@ -230,9 +230,9 @@ {% if SUPPORTS %}
  • {% for name, link, logo_url, title in SUPPORTS %} - +
  • - +
  • {% endfor %} {% endif %} diff --git a/templates/partials/article-short.html b/templates/partials/article-short.html index 4f3fe87..20e758b 100644 --- a/templates/partials/article-short.html +++ b/templates/partials/article-short.html @@ -1,11 +1,18 @@ -
    -

    {{ article.title|e }}

    - - -

    {{ article.summary|striptags|striptags }}

    - {% if not MG_DISABLE_SUMMARY %}

    {{ ' '.join(article.content.split(' ')[:SUMMARY_MAX_LENGTH])|striptags|striptags }}...

    {% endif %} - Read More - {% include "partials/inline-tags.html" %} +
    +
    + {% if article.featured_image %} + + {% endif %} +
    +

    {{ article.title|e }}

    + + +

    {{ article.summary|striptags|striptags }}

    + {% if not MG_DISABLE_SUMMARY %}

    {{ ' '.join(article.content.split(' ')[:75])|striptags|striptags }}...

    {% endif %} + Read More + {% include "partials/inline-tags.html" %} +
    +

    diff --git a/templates/partials/inline-tags.html b/templates/partials/inline-tags.html index 62fd5d8..fd952c6 100644 --- a/templates/partials/inline-tags.html +++ b/templates/partials/inline-tags.html @@ -1,3 +1,3 @@ {% set bullet = joiner(" • ") %} -
    {% for tag in article.tags %}{{bullet()}} {{tag.name}}{% endfor %}
    +
    {% for tag in article.tags %}{{bullet()}} {{tag.name}}{% endfor %}