Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add header images and background colors. Fixes #52 #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ Sidebar image
- ``SITESEARCH``: [default: 'http://google.com/search'] search engine to which
search form should be pointed (optional)

Header image or background color
--------------------------------

Header background image or color can be configured using article metadata or
global settings in the following order of preference:

- ``header_cover`` - header background image. Configure as article metadata
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you have listed the options in the same order of priority given in the code. Can you write just a line before to make it explicit in the doc?

Also, wouldn't it be better to actually give more priority to the article's properties instead of cover -> color? Something like:

  1. article's header_cover property
  2. article's header_color property
  3. global HEADER_COVER
  4. global HEADER_COLOR

- ``header_color`` - header background color. Configure as article metadata
- ``HEADER_COVER`` - global header background image setting
- ``HEADER_COLOR`` - global header background color setting

QR Code generation
-------------

Expand Down
13 changes: 12 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@
</head>

<body>
<header role="banner">{% include '_includes/header.html' %}</header>
<header role="banner"
{% if article and article.header_cover %}
style="background-image: url('{{ article.header_cover }}')"
{% elif article and article.header_color %}
style="background-color: {{ article.header_color }}"
{% elif HEADER_COVER %}
style="background-image: url('{{ HEADER_COVER }}')"
{% elif HEADER_COLOR %}
style="background-color: {{ HEADER_COLOR }}"
{% endif %}
>
{% include '_includes/header.html' %}</header>
<nav role="navigation">{% include '_includes/navigation.html' %}</nav>
<div id="main">
<div id="content">
Expand Down