diff options
Diffstat (limited to 'site-src/themes/hack/templates')
-rw-r--r-- | site-src/themes/hack/templates/base.tmpl | 38 | ||||
-rw-r--r-- | site-src/themes/hack/templates/base_helper.tmpl | 131 |
2 files changed, 169 insertions, 0 deletions
diff --git a/site-src/themes/hack/templates/base.tmpl b/site-src/themes/hack/templates/base.tmpl new file mode 100644 index 0000000..b0f2c4e --- /dev/null +++ b/site-src/themes/hack/templates/base.tmpl @@ -0,0 +1,38 @@ +## -*- coding: utf-8 -*- +<%namespace name="base" file="base_helper.tmpl" import="*"/> +<%namespace name="header" file="base_header.tmpl" import="*"/> +<%namespace name="footer" file="base_footer.tmpl" import="*"/> +<%namespace name="annotations" file="annotation_helper.tmpl"/> +${set_locale(lang)} +${base.html_headstart()} +<%block name="extra_head"> +### Leave this block alone. +</%block> +${template_hooks['extra_head']()} +</head> +% if not HACK_VARIANT: + <body class="hack"> +% elif HACK_VARIANT == 'dark': + <body class="hack dark"> +% elif HACK_VARIANT == 'dark-grey': + <body class="hack dark-grey"> +% elif HACK_VARIANT == 'solarized-dark': + <body class="hack solarized-dark"> +% elif HACK_VARIANT == 'standard': + <body class="hack standard"> +% endif + +<a href="#content" class="sr-only sr-only-focusable">${messages("Skip to main content")}</a> + <div id="container"> + ${header.html_header()} + <main id="content"> + <%block name="content"></%block> + </main> + ${footer.html_footer()} + </div> + ${base.late_load_js()} + <%block name="extra_js"></%block> + ${body_end} + ${template_hooks['body_end']()} +</body> +</html> diff --git a/site-src/themes/hack/templates/base_helper.tmpl b/site-src/themes/hack/templates/base_helper.tmpl new file mode 100644 index 0000000..5f5b4ab --- /dev/null +++ b/site-src/themes/hack/templates/base_helper.tmpl @@ -0,0 +1,131 @@ +## -*- coding: utf-8 -*- + +<%def name="html_headstart()"> +<!DOCTYPE html> +<html \ +prefix='\ +%if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']): +og: http://ogp.me/ns# article: http://ogp.me/ns/article# \ +%endif +%if comment_system == 'facebook': +fb: http://ogp.me/ns/fb# +%endif +' \ +%if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']): +vocab="http://ogp.me/ns" \ +%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|h}"> + %endif + <meta name="viewport" content="width=device-width"> + %if title == blog_title: + <title>${blog_title|h}</title> + %else: + <title>${title|h} | ${blog_title|h}</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 + + %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} +</%def> + +<%def name="late_load_js()"> + ${social_buttons_code} +</%def> + +<%def name="html_stylesheets()"> + <link href="/assets/css/rst.css" rel="stylesheet" type="text/css"> + <link href="/assets/css/code.css" rel="stylesheet" type="text/css"> + % if not HACK_VARIANT: + <link href="/assets/css/hack.css" rel="stylesheet" type="text/css"> + % elif HACK_VARIANT == 'dark': + <link href="/assets/css/dark.css" rel="stylesheet" type="text/css"> + % elif HACK_VARIANT == 'dark-grey': + <link href="/assets/css/dark-grey.css" rel="stylesheet" type="text/css"> + % elif HACK_VARIANT == 'solarized-dark': + <link href="/assets/css/solarized-dark.css" rel="stylesheet" type="text/css"> + % elif HACK_VARIANT == 'standard': + <link href="/assets/css/standard.css" rel="stylesheet" type="text/css"> + % endif + <link href="/assets/css/theme.css" rel="stylesheet" type="text/css"> + <link href="https://fonts.googleapis.com/css?family=Share+Tech+Mono" rel="stylesheet"> + %if has_custom_css: + <link href="/assets/css/custom.css" rel="stylesheet" type="text/css"> + %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 +</%def> + +<%def name="html_feedlinks()"> + %if rss_link: + ${rss_link} + %elif generate_rss: + %if len(translations) > 1: + %for language in sorted(translations): + <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 len(translations) > 1: + %for language in sorted(translations): + <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 +</%def> + +<%def name="html_translations()"> + <ul class="translations"> + %for langname in sorted(translations): + %if langname != lang: + <li><a href="${abs_link(_link("root", None, langname))}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></li> + %endif + %endfor + </ul> +</%def> |