Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Create bootblog4-jinja, make bootstrap4-jinja work
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
- Loading branch information
Showing
17 changed files
with
435 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
nikola/data/themes/base-jinja/templates/comments_helper_commento.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
{% macro comment_form(url, title, identifier) %} | ||
<div id="commento"></div> | ||
{% endmacro %} | ||
|
||
{% macro comment_link(link, identifier) %} | ||
{% endmacro %} | ||
|
||
|
||
{% macro comment_link_script() %} | ||
<script src="{{ comment_system_id }}/assets/js/commento.min.js"></script> | ||
<script> | ||
window.onload = function() { | ||
Commento.init({ | ||
serverUrl: "{{ comment_system_id }}", | ||
}); | ||
} | ||
</script> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This is a theme based on Bootstrap 4 and the [blog example](https://getbootstrap.com/docs/4.0/examples/blog/) by @mdo. | ||
|
||
Note that unlike previous versions of Bootstrap, icon fonts are not built-in. | ||
You can use Font Awesome for this. | ||
|
||
This theme **does not** support Bootswatch font/color schemes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../bootblog4/assets/css/bootblog.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Theme] | ||
engine = jinja | ||
parent = bootstrap4-jinja | ||
author = The Nikola Contributors | ||
author_url = https://getnikola.com/ | ||
license = MIT | ||
based_on = Bootstrap 4 <http://getbootstrap.com/>, Bootstrap 4 blog example <http://getbootstrap.com/docs/4.0/examples/blog/> | ||
tags = bootstrap | ||
|
||
[Family] | ||
family = bootstrap4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../bootblog4/bundles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
{% import 'base_helper.tmpl' as base with context %} | ||
{% import 'annotation_helper.tmpl' as notes with context %} | ||
{{ set_locale(lang) }} | ||
{{ base.html_headstart() }} | ||
{% block extra_head %} | ||
{# Leave this block alone. #} | ||
{% endblock %} | ||
{{ template_hooks['extra_head']() }} | ||
</head> | ||
<body> | ||
<a href="#content" class="sr-only sr-only-focusable">{{ messages("Skip to main content") }}</a> | ||
|
||
<!-- Header and menu bar --> | ||
<div class="container"> | ||
<header class="blog-header py-3"> | ||
<div class="row nbb-header align-items-center"> | ||
<div class="col-md-3 col-xs-2" style="padding: 0; width: auto;"> | ||
<button class="navbar-toggler navbar-light bg-light nbb-navbar-toggler" type="button" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
{{ search_form }} | ||
</div> | ||
<div class="col-md-6 col-xs-10 text-center" style="width: auto;"> | ||
<a class="navbar-brand blog-header-logo text-dark" href="{{ abs_link(_link("root", None, lang)) }}"> | ||
{% if logo_url %} | ||
<img src="{{ logo_url }}" alt="{{ blog_title|e }}" id="logo" class="d-inline-block align-top"> | ||
{% endif %} | ||
|
||
{% if show_blog_title %} | ||
<span id="blog-title">{{ blog_title|e }}</span> | ||
{% endif %} | ||
</a> | ||
</div> | ||
<div class="col-md-3 d-flex justify-content-end align-items-center"> | ||
{% block belowtitle %} | ||
{% if translations|length > 1 %} | ||
{{ base.html_translations() }} | ||
{% endif %} | ||
{% endblock %} | ||
<div class="d-none d-md-inline">{% block sourcelink %}{% endblock %}</div> | ||
{{ template_hooks['menu_alt']() }} | ||
</div> | ||
</div> | ||
</header> | ||
|
||
<nav class="navbar navbar-expand-md navbar-light bg-white static-top"> | ||
<div class="collapse navbar-collapse" id="bs-navbar"> | ||
<ul class="navbar-nav nav-fill d-flex w-100"> | ||
{{ base.html_navigation_links() }} | ||
{{ template_hooks['menu']() }} | ||
</ul> | ||
</div><!-- /.navbar-collapse --> | ||
</nav> | ||
|
||
<div class="container" id="content" role="main"> | ||
<div class="body-content"> | ||
<!--Body content--> | ||
{{ template_hooks['page_header']() }} | ||
{% block content %}{% endblock %} | ||
<!--End of body content--> | ||
|
||
<footer id="footer"> | ||
{{ content_footer }} | ||
{{ template_hooks['page_footer']() }} | ||
</footer> | ||
</div> | ||
</div> | ||
|
||
{{ base.late_load_js() }} | ||
<!-- fancy dates --> | ||
<script> | ||
moment.locale("{{ momentjs_locales[lang] }}"); | ||
fancydates({{ date_fanciness }}, {{ js_date_format }}); | ||
</script> | ||
<!-- end fancy dates --> | ||
{% block extra_js %}{% endblock %} | ||
<script> | ||
baguetteBox.run('a.reference:not(.islink)', { | ||
captions: function(element) { | ||
return element.getElementsByTagName('img')[0].alt; | ||
}}); | ||
baguetteBox.run('img:not(.islink)', { | ||
captions: function(element) { | ||
return element.alt; | ||
}}); | ||
</script> | ||
{{ body_end }} | ||
{{ template_hooks['body_end']() }} | ||
</body> | ||
</html> |
197 changes: 197 additions & 0 deletions
197
nikola/data/themes/bootblog4-jinja/templates/base_helper.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
|
||
{% import 'annotation_helper.tmpl' as notes with context %} | ||
{% macro html_headstart() %} | ||
<!DOCTYPE html> | ||
<html | ||
|
||
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook') %} | ||
prefix=' | ||
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %} | ||
og: http://ogp.me/ns# | ||
{% endif %} | ||
{% if use_open_graph %} | ||
article: http://ogp.me/ns/article# | ||
{% endif %} | ||
{% if comment_system == 'facebook' %} | ||
fb: http://ogp.me/ns/fb# | ||
{% endif %} | ||
' | ||
{% endif %} | ||
|
||
{% if is_rtl %} | ||
dir="rtl" | ||
{% endif %} | ||
|
||
lang="{{ lang }}"> | ||
<head> | ||
<meta charset="utf-8"> | ||
{% if use_base_tag %} | ||
<base href="{{ abs_link(permalink) }}"> | ||
{% endif %} | ||
{% if description %} | ||
<meta name="description" content="{{ description|e }}"> | ||
{% endif %} | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
{% if title == blog_title %} | ||
<title>{{ blog_title|e }}</title> | ||
{% else %} | ||
<title>{{ title|e }} | {{ blog_title|e }}</title> | ||
{% endif %} | ||
|
||
{{ html_stylesheets() }} | ||
<meta name="theme-color" content="{{ theme_color }}"> | ||
{% if meta_generator_tag %} | ||
<meta name="generator" content="Nikola (getnikola.com)"> | ||
{% endif %} | ||
{{ html_feedlinks() }} | ||
<link rel="canonical" href="{{ abs_link(permalink) }}"> | ||
|
||
{% if favicons %} | ||
{% for name, file, size in favicons %} | ||
<link rel="{{ name }}" href="{{ file }}" sizes="{{ size }}"/> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if comment_system == 'facebook' %} | ||
<meta property="fb:app_id" content="{{ comment_system_id }}"> | ||
{% endif %} | ||
|
||
{% if prevlink %} | ||
<link rel="prev" href="{{ prevlink }}" type="text/html"> | ||
{% endif %} | ||
{% if nextlink %} | ||
<link rel="next" href="{{ nextlink }}" type="text/html"> | ||
{% endif %} | ||
|
||
{{ mathjax_config }} | ||
{% if use_cdn %} | ||
<!--[if lt IE 9]><script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]--> | ||
{% else %} | ||
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang, url_type) }}"></script><![endif]--> | ||
{% endif %} | ||
|
||
{{ extra_head_data }} | ||
{% endmacro %} | ||
|
||
{% macro late_load_js() %} | ||
{% if use_bundles %} | ||
{% if use_cdn %} | ||
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.13.0/umd/popper.min.js" integrity="sha256-pS96pU17yq+gVu4KBQJi38VpSuKN7otMrDQprzf/DWY=" crossorigin="anonymous"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js" integrity="sha256-lQrWH6UPtNlJURtEYCgKDqLyBscHa/uF/nFle9bx3tI=" crossorigin="anonymous"></script> | ||
<script src="/assets/js/all.js"></script> | ||
{% else %} | ||
<script src="/assets/js/all-nocdn.js"></script> | ||
{% endif %} | ||
{% else %} | ||
{% if use_cdn %} | ||
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.13.0/umd/popper.min.js" integrity="sha256-pS96pU17yq+gVu4KBQJi38VpSuKN7otMrDQprzf/DWY=" crossorigin="anonymous"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js" integrity="sha256-lQrWH6UPtNlJURtEYCgKDqLyBscHa/uF/nFle9bx3tI=" crossorigin="anonymous"></script> | ||
{% else %} | ||
<script src="/assets/js/jquery.min.js"></script> | ||
<script src="/assets/js/popper.min.js"></script> | ||
<script src="/assets/js/bootstrap.min.js"></script> | ||
<script src="/assets/js/baguetteBox.min.js"></script> | ||
<script src="/assets/js/moment-with-locales.min.js"></script> | ||
<script src="/assets/js/fancydates.js"></script> | ||
{% endif %} | ||
{% endif %} | ||
{{ social_buttons_code }} | ||
{% endmacro %} | ||
|
||
|
||
{% macro html_stylesheets() %} | ||
{% if use_bundles %} | ||
{% if use_cdn %} | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css" integrity="sha256-FqCzNnnyXl5HxHMdb+RQ/RV/X7fqfPcQYy+G2gFL3Xk=" crossorigin="anonymous" /> | ||
<link href="/assets/css/all.css" rel="stylesheet" type="text/css"> | ||
{% else %} | ||
<link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css"> | ||
{% endif %} | ||
{% else %} | ||
{% if use_cdn %} | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css" integrity="sha256-FqCzNnnyXl5HxHMdb+RQ/RV/X7fqfPcQYy+G2gFL3Xk=" crossorigin="anonymous" /> | ||
{% else %} | ||
<link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css"> | ||
<link href="/assets/css/baguetteBox.min.css" rel="stylesheet" type="text/css"> | ||
{% endif %} | ||
<link href="/assets/css/rst.css" rel="stylesheet" type="text/css"> | ||
<link href="/assets/css/code.css" rel="stylesheet" type="text/css"> | ||
<link href="/assets/css/theme.css" rel="stylesheet" type="text/css"> | ||
<link href="/assets/css/bootblog.css" rel="stylesheet" type="text/css"> | ||
{% if has_custom_css %} | ||
<link href="/assets/css/custom.css" rel="stylesheet" type="text/css"> | ||
{% endif %} | ||
{% endif %} | ||
{% if needs_ipython_css %} | ||
<link href="/assets/css/ipython.min.css" rel="stylesheet" type="text/css"> | ||
<link href="/assets/css/nikola_ipython.css" rel="stylesheet" type="text/css"> | ||
{% endif %} | ||
<link href="https://fonts.googleapis.com/css?family=Playfair+Display:700,900" rel="stylesheet"> | ||
{% if annotations and post and not post.meta('noannotations') %} | ||
{{ notes.css() }} | ||
{% elif not annotations and post and post.meta('annotations') %} | ||
{{ notes.css() }} | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro html_navigation_links() %} | ||
{% for url, text in navigation_links[lang] %} | ||
{% if isinstance(url, tuple) %} | ||
<li class="nav-item dropdown"><a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{ text }}</a> | ||
<div class="dropdown-menu"> | ||
{% for suburl, text in url %} | ||
{% if rel_link(permalink, suburl) == "#" %} | ||
<a href="{{ permalink }}" class="dropdown-item active">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a> | ||
{% else %} | ||
<a href="{{ suburl }}" class="dropdown-item">{{ text }}</a> | ||
{% endif %} | ||
{% endfor %} | ||
</div> | ||
{% else %} | ||
{% if rel_link(permalink, url) == "#" %} | ||
{# <a class="p-2 text-white bg-secondary active" href="{{ url }}">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a> #} | ||
<li class="nav-item active"><a href="{{ permalink }}" class="nav-link">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a> | ||
{% else %} | ||
<li class="nav-item"><a href="{{ url }}" class="nav-link">{{ text }}</a> | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endmacro %} | ||
|
||
{% macro html_feedlinks() %} | ||
{% if rss_link %} | ||
{{ rss_link }} | ||
{% elif generate_rss %} | ||
{% if translations|length > 1 %} | ||
{% for language in translations|sort %} | ||
<link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}"> | ||
{% endfor %} | ||
{% else %} | ||
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link('rss', None) }}"> | ||
{% endif %} | ||
{% endif %} | ||
{% if generate_atom %} | ||
{% if translations|length > 1 %} | ||
{% for language in translations|sort %} | ||
<link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link('index_atom', None, language) }}"> | ||
{% endfor %} | ||
{% else %} | ||
<link rel="alternate" type="application/atom+xml" title="Atom" href="{{ _link('index_atom', None) }}"> | ||
{% endif %} | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro html_translations() %} | ||
{% for langname in translations|sort %} | ||
{% if langname != lang %} | ||
<a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}" class="p-2 text-secondary">{{ messages("LANGUAGE", langname) }}</a> | ||
{% endif %} | ||
{% endfor %} | ||
{% endmacro %} |
Oops, something went wrong.