From c0814fd985acc46c18974d1933514dc45a2208c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 17 Jan 2018 01:10:36 +0100 Subject: [PATCH] Ability to show list of latest news on the index page. --- css/m-components.css | 15 +++++++ doc/css/page-layout.rst | 41 ++++++++++++++++++ doc/pelican/theme.rst | 20 +++++++++ pelican-theme/templates/page.html | 14 +++++++ pelican-theme/test/__init__.py | 4 +- .../test/blog_news_on_index/article.rst | 4 ++ .../test/blog_news_on_index/article2.rst | 4 ++ .../test/blog_news_on_index/article3.rst | 4 ++ .../test/blog_news_on_index/index.html | 42 +++++++++++++++++++ .../test/blog_news_on_index/pages/index.rst | 5 +++ pelican-theme/test/test_blog.py | 12 ++++++ 11 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 pelican-theme/test/blog_news_on_index/article.rst create mode 100644 pelican-theme/test/blog_news_on_index/article2.rst create mode 100644 pelican-theme/test/blog_news_on_index/article3.rst create mode 100644 pelican-theme/test/blog_news_on_index/index.html create mode 100644 pelican-theme/test/blog_news_on_index/pages/index.rst diff --git a/css/m-components.css b/css/m-components.css index 64cf7f47..76f605af 100644 --- a/css/m-components.css +++ b/css/m-components.css @@ -515,6 +515,21 @@ article#m-jumbo.m-inverted > header a:hover, article#m-jumbo.m-inverted > header color: #0f0f0f; } +/* News list on landing pages */ +.m-landing-news h3 a { + color: var(--color); + text-decoration: none; + text-transform: var(--nav-heading-case); +} +.m-landing-news h3 a:hover, .m-landing-news h3 a:hover, .m-landing-news h3 a:focus, .m-landing-news h3 a:active { + color: var(--article-heading-color); +} +.m-landing-news time { + display: inline-block; + margin-left: 1rem; + float: right; +} + /* Article pagination */ .m-article-pagination { text-align: center; diff --git a/doc/css/page-layout.rst b/doc/css/page-layout.rst index e8b84756..96817041 100644 --- a/doc/css/page-layout.rst +++ b/doc/css/page-layout.rst @@ -698,3 +698,44 @@ and save vertical space. For a tag cloud, mark the :html:` + +`News list on index page`_ +-------------------------- + +Sometimes you may want just a small list of news items tucked to the bottom of +an index page that's otherwise full of other content. Mark a block with +:css:`.m-landing-news` and put a list of articles in it. The :html:`

` can +be used to link to the blog front page; if you use the :html:`