Skip to content

Commit

Permalink
Fix #1122 -- add support for logos.
Browse files Browse the repository at this point in the history
Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 4, 2014
1 parent ebd3b44 commit 2a05745
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Added LOGO_URL and SHOW_BLOG_TITLE=True settings to facilitate showing off logos (Issue #1122)
* Create automatic story index pages for subfolders, too (Issue #793)
* New Slovak translation by Tomáš Prékop
* Created a MarkdownExtension plugin class (Issue #1175)
Expand Down
9 changes: 9 additions & 0 deletions nikola/conf.py.in
Expand Up @@ -133,6 +133,15 @@ COMPILERS = ${COMPILERS}
# Formerly known as HIDE_UNTRANSLATED_POSTS (inverse)
# SHOW_UNTRANSLATED_POSTS = True

# Nikola supports logo display. If you have one, you can put the URL here.
# Final output is <img src="LOGO_URL" id="logo" alt="BLOG_TITLE">.
# The URL may be relative to the site root.
# LOGO_URL = ''

# If you want to hide the title of your website (for example, if your logo
# already contains the text), set this to False.
# SHOW_BLOG_TITLE = True

# Paths for different autogenerated bits. These are combined with the
# translation paths.

Expand Down
10 changes: 9 additions & 1 deletion nikola/data/themes/base-jinja/templates/base_header.tmpl
Expand Up @@ -15,7 +15,15 @@
{% endmacro %}

{% macro html_site_title() %}
<h1 id="blog-title"><a href="{{ abs_link('/') }}" title="{{ blog_title }}" rel="home">{{ blog_title }}</a></h1>
<h1 id="brand"><a href="{{ abs_link('/') }}" title="{{ blog_title }}" rel="home">
{% if logo_url %}
<img src="{{ logo_url }}" alt="{{ blog_title }}" id="logo">
{% endif %}

{% if show_blog_title %}
<span id="blog-title">{{ blog_title }}</span>
{% endif %}
</a></h1>
{% endmacro %}

{% macro html_navigation_links() %}
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base/assets/css/theme.css
Expand Up @@ -171,7 +171,7 @@ body {
display: inline;
}

#blog-title {
#brand {
font-size: 3em;
line-height: 1;
}
Expand All @@ -188,8 +188,8 @@ body {
color: #0d53a3;
}

#blog-title :link,
#blog-title :visited {
#brand :link,
#brand :visited {
color: inherit;
}

Expand Down
10 changes: 9 additions & 1 deletion nikola/data/themes/base/templates/base_header.tmpl
Expand Up @@ -15,7 +15,15 @@
</%def>

<%def name="html_site_title()">
<h1 id="blog-title"><a href="${abs_link('/')}" title="${blog_title}" rel="home">${blog_title}</a></h1>
<h1 id="brand"><a href="${abs_link('/')}" title="${blog_title}" rel="home">
%if logo_url:
<img src="${logo_url}" alt="${blog_title}" id="logo">
%endif

% if show_blog_title:
<span id="blog-title">${blog_title}</span>
% endif
</a></h1>
</%def>

<%def name="html_navigation_links()">
Expand Down
8 changes: 7 additions & 1 deletion nikola/data/themes/bootstrap-jinja/templates/base.tmpl
Expand Up @@ -24,7 +24,13 @@
</a>

<a class="brand" href="{{ abs_link('/') }}">
{{ blog_title }}
{% if logo_url %}
<img src="{{ logo_url }}" alt="{{ blog_title }}" id="logo">
{% endif %}

{% if show_blog_title %}
<span id="blog-title">{{ blog_title }}</span>
{% endif %}
</a>
<!-- Everything you want hidden at 940px or less, place within here -->
<div class="nav-collapse collapse">
Expand Down
19 changes: 14 additions & 5 deletions nikola/data/themes/bootstrap/assets/css/theme.css
Expand Up @@ -151,15 +151,24 @@ h4, h5, h6 {
}

.posttranslations h3 {
display: inline;
font-size: 1em;
font-weight: bold;
display: inline;
font-size: 1em;
font-weight: bold;
}

.posttranslations h3:last-child {
display: none;
display: none;
}

.entry-content {
margin-top: 1em;
margin-top: 1em;
}

.navbar .brand {
padding: 0 20px;
}

.navbar .brand #blog-title {
padding: 10px 0;
display: inline-block;
}
8 changes: 7 additions & 1 deletion nikola/data/themes/bootstrap/templates/base.tmpl
Expand Up @@ -24,7 +24,13 @@ ${base.html_headstart()}
</a>

<a class="brand" href="${abs_link('/')}">
${blog_title}
%if logo_url:
<img src="${logo_url}" alt="${blog_title}" id="logo">
%endif

% if show_blog_title:
<span id="blog-title">${blog_title}</span>
% endif
</a>
<!-- Everything you want hidden at 940px or less, place within here -->
<div class="nav-collapse collapse">
Expand Down
10 changes: 9 additions & 1 deletion nikola/data/themes/bootstrap3-jinja/templates/base.tmpl
Expand Up @@ -20,7 +20,15 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ abs_link('/') }}">{{ blog_title }}</a>
<a class="navbar-brand" href="{{ abs_link('/') }}">
{% if logo_url %}
<img src="{{ logo_url }}" alt="{{ blog_title }}" id="logo">
{% endif %}

{% if show_blog_title %}
<span id="blog-title">{{ blog_title }}</span>
{% endif %}
</a>
</div><!-- /.navbar-header -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
Expand Down
19 changes: 14 additions & 5 deletions nikola/data/themes/bootstrap3/assets/css/theme.css
Expand Up @@ -152,15 +152,24 @@ h4, h5, h6 {
}

.posttranslations h3 {
display: inline;
font-size: 1em;
font-weight: bold;
display: inline;
font-size: 1em;
font-weight: bold;
}

.posttranslations h3:last-child {
display: none;
display: none;
}

.entry-content {
margin-top: 1em;
margin-top: 1em;
}

.navbar-brand {
padding: 0 15px;
}

.navbar-brand #blog-title {
padding: 15px 0;
display: inline-block;
}
10 changes: 9 additions & 1 deletion nikola/data/themes/bootstrap3/templates/base.tmpl
Expand Up @@ -20,7 +20,15 @@ ${base.html_headstart()}
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="${abs_link('/')}">${blog_title}</a>
<a class="navbar-brand" href="${abs_link('/')}">
%if logo_url:
<img src="${logo_url}" alt="${blog_title}" id="logo">
%endif

% if show_blog_title:
<span id="blog-title">${blog_title}</span>
% endif
</a>
</div><!-- /.navbar-header -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
Expand Down
4 changes: 4 additions & 0 deletions nikola/nikola.py
Expand Up @@ -240,6 +240,7 @@ def __init__(self, **config):
'LICENSE': '',
'LINK_CHECK_WHITELIST': [],
'LISTINGS_FOLDER': 'listings',
'LOGO_URL': '',
'NAVIGATION_LINKS': {},
'MARKDOWN_EXTENSIONS': ['fenced_code', 'codehilite'],
'MAX_IMAGE_SIZE': 1280,
Expand All @@ -259,6 +260,7 @@ def __init__(self, **config):
'SASS_COMPILER': 'sass',
'SASS_OPTIONS': [],
'SEARCH_FORM': '',
'SHOW_BLOG_TITLE': True,
'SHOW_SOURCELINK': True,
'SHOW_UNTRANSLATED_POSTS': True,
'SLUG_TAG_PATH': True,
Expand Down Expand Up @@ -517,6 +519,8 @@ def __init__(self, **config):
'DATE_FORMAT', '%Y-%m-%d %H:%M')
self._GLOBAL_CONTEXT['blog_author'] = self.config.get('BLOG_AUTHOR')
self._GLOBAL_CONTEXT['blog_title'] = self.config.get('BLOG_TITLE')
self._GLOBAL_CONTEXT['show_blog_title'] = self.config.get('SHOW_BLOG_TITLE')
self._GLOBAL_CONTEXT['logo_url'] = self.config.get('LOGO_URL')
self._GLOBAL_CONTEXT['blog_description'] = self.config.get('BLOG_DESCRIPTION')

# TODO: remove in v8
Expand Down

0 comments on commit 2a05745

Please sign in to comment.