Like landing pages, but trading some of the flexibility for easier use.
}
/* Landing page, jumbo article */
-#m-landing-image, article#m-jumbo > header #m-jumbo-image {
+#m-landing-image, #m-cover-image, article#m-jumbo > header #m-jumbo-image {
background-size: cover;
background-color: var(--cover-image-background-color);
background-position: center center;
#m-landing-image {
color: #ffffff;
}
+#m-cover-image {
+ height: 30rem;
+ margin-bottom: -26rem;
+}
#m-landing-cover {
padding-bottom: 10rem;
margin-bottom: -6rem;
height: 60vh;
margin-bottom: 1rem;
}
-#m-landing-cover, article#m-jumbo > header #m-jumbo-cover {
+#m-landing-cover, #m-cover-image > div, article#m-jumbo > header #m-jumbo-cover {
background: linear-gradient(transparent 0%, transparent 50%, var(--background-color) 100%);
width: 100%;
height: 100%;
.. code:: html
<main><article>
- <div id="m-landing-image" style="background-image: url('ship.jpg');">
+ <div id="m-landing-image" style="background-image: url('landing.jpg');">
<div id="m-landing-cover">
<div class="m-container">
<!-- content displayed over the cover image -->
You can see landing page in action `on the main page <{filename}/index.rst>`_.
+`Pages with cover image`_
+-------------------------
+
+If you just want slide a cover image under content of your page and don't need
+to have control over what content is over the image and what under, simply put
+the following markup in front of your page content --- an outer
+:css:`#m-cover-image` element with background image and an inner empty
+:html:`<div>` that takes care of the fade out gradient over it.
+
+.. code:: html
+ :class: m-inverted
+ :hl_lines: 2 3 4
+
+ <main>
+ <div id="m-cover-image" style="background-image: url('cover.jpg');">
+ <div></div>
+ </div>
+ <article>
+ <div class="m-container">
+ <!-- the whole content of your page goes here -->
+ </div>
+ </article>
+ </main>
+
+.. note-info::
+
+ Real-world example of a page with cover image can be seen on the
+ `Magnum Engine website <http://magnum.graphics/features/>`_.
+
`Breadcrumb navigation`_
------------------------
You can see the landing page in action on the `main project page <{filename}/index.rst>`_.
+`Pages with cover image`_
+-------------------------
+
+Besides full-blown landing pages that give you control over the whole layout,
+you can add cover images to regular pages by just specifying the :rst:`:cover:`
+field but omitting the :rst:`:landing:` field. See corresponding section
+`in the CSS page layout docs <{filename}/css/page-layout.rst#pages-with-cover-image>`_
+for details about how the cover image affects page layout.
+
+.. note-info::
+
+ Real-world example of a page with cover image can be seen on the
+ `Magnum Engine website <http://magnum.graphics/features/extensions/>`_.
+
`Page header and footer`_
-------------------------
The :rst:`:header:` field is not supported on `landing pages`_. In case
both :rst:`:landing:` and :rst:`:header:` is present, :rst:`:header:` is
- ignored.
+ ignored. However, it works as expected if just :rst:`:cover:` is present.
`(Social) meta tags for pages`_
-------------------------------
{% endblock %}
{% block main %}
-{% if not page.landing and page.header %}
+{% if not page.landing %}
+{% if page.cover %}
+<div id="m-cover-image" style="background-image: url('{{ page.cover|expand_link(page)|e }}');"><div></div></div>
+{% endif %}
+{% if page.header %}
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1 m-nopadb">
</div>
</div>
{% endif %}
+{% endif %}
<article>
{% if page.landing %}
<div id="m-landing-image"{% if page.cover %} style="background-image: url('{{ page.cover|expand_link(page)|e }}');"{% endif %}>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en" prefix="og: http://ogp.me/ns#">
+<head>
+ <meta charset="UTF-8" />
+ <title>A page | A Pelican Blog</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
+ <link rel="stylesheet" href="static/m-dark.css" />
+ <link rel="canonical" href="page.html" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta property="og:site_name" content="A Pelican Blog" />
+ <meta property="og:title" content="A page" />
+ <meta name="twitter:title" content="A page" />
+ <meta property="og:url" content="page.html" />
+ <meta property="og:description" content="Page text." />
+ <meta name="twitter:description" content="Page text." />
+ <meta property="og:image" content="./ship.jpg" />
+ <meta name="twitter:image" content="./ship.jpg" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta property="og:type" content="page" />
+</head>
+<body>
+<header><nav id="navigation" class="m-navbar-cover">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+ </div>
+ </div>
+</nav></header>
+<main>
+<div id="m-cover-image" style="background-image: url('./ship.jpg');"><div></div></div>
+<div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1 m-nopadb">
+<!-- header -->
+This is visible on the top and doesn't break the layout.
+<!-- /header -->
+ </div>
+ </div>
+</div>
+<article>
+ <div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1">
+ <h1>A page</h1>
+<!-- content -->
+<p>Page text.</p>
+<!-- /content -->
+ </div>
+ </div>
+ </div>
+</article>
+<div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1 m-nopadt">
+<!-- footer -->
+This is visible on the bottom.
+<!-- /footer -->
+ </div>
+ </div>
+</div>
+</main>
+</body>
+</html>
--- /dev/null
+A page
+######
+
+:cover: {filename}/ship.jpg
+:header: This is visible on the top and doesn't break the layout.
+:footer: This is visible on the bottom.
+
+Page text.
--- /dev/null
+../../../doc/static/ship.jpg
\ No newline at end of file
self.assertEqual(*self.actual_expected_contents('page.html'))
self.assertEqual(*self.actual_expected_contents('hide-navbar-brand.html'))
+class Cover(PageTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'cover', *args, **kwargs)
+
+ def test(self):
+ self.run_pelican({
+ 'STATIC_PATHS': ['ship.jpg'],
+ # Verify that the image is propagated to social meta tags
+ 'M_DISABLE_SOCIAL_META_TAGS': False,
+ })
+
+ # Header and footer should be shown and should not break the layout
+ self.assertEqual(*self.actual_expected_contents('page.html'))
+
class TitleSitenameAlias(PageTestCase):
def __init__(self, *args, **kwargs):
super().__init__(__file__, 'title_sitename_alias', *args, **kwargs)