mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-08-01 10:18:54 -04:00
Initial commit of rework
This commit is contained in:
273
src/base.html
273
src/base.html
@@ -1,3 +1,25 @@
|
||||
<!--
|
||||
Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if lt IE 7 ]> <html class="no-js ie6"> <![endif]-->
|
||||
<!--[if IE 7 ]> <html class="no-js ie7"> <![endif]-->
|
||||
@@ -9,7 +31,7 @@
|
||||
<!-- Charset and viewport -->
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,
|
||||
user-scalable=no, initial-scale=1, maximum-scale=1" />
|
||||
user-scalable=no, initial-scale=1, maximum-scale=1" />
|
||||
|
||||
<!-- General meta tags -->
|
||||
{% block htmltitle %}
|
||||
@@ -39,44 +61,19 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
<!-- Open graph tags -->
|
||||
<meta property="og:url" content="{{ canonical_url }}" />
|
||||
<meta property="og:title" content="{{ site_name }}"/>
|
||||
<meta property="og:image"
|
||||
content="{{ canonical_url }}/{{ base_url }}/{{ config.extra.logo }}" />
|
||||
|
||||
<!-- Web application capability on iOS -->
|
||||
<meta name="apple-mobile-web-app-title" content="{{ site_name }}" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style"
|
||||
content="black-translucent" />
|
||||
|
||||
<!-- Web application icon on iOS -->
|
||||
{% if config.extra.logo %}
|
||||
<link rel="apple-touch-icon"
|
||||
href="{{ base_url }}/{{ config.extra.logo }}">
|
||||
{% endif %}
|
||||
|
||||
<!-- Favicon -->
|
||||
{% set icon = icon | default("assets/images/favicon.ico") %}
|
||||
<link rel="shortcut icon" type="image/x-icon"
|
||||
href="{{ base_url }}/{{ icon }}" />
|
||||
<link rel="icon" type="image/x-icon"
|
||||
href="{{ base_url }}/{{ icon }}" />
|
||||
|
||||
<!-- Configure icons (placed here to omit issues with subdirectories) -->
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Icon';
|
||||
src: url('{{ base_url }}/assets/fonts/icon.eot?52m981');
|
||||
src: url('{{ base_url }}/assets/fonts/icon.eot?#iefix52m981')
|
||||
format('embedded-opentype'),
|
||||
url('{{ base_url }}/assets/fonts/icon.woff?52m981')
|
||||
format('woff'),
|
||||
url('{{ base_url }}/assets/fonts/icon.ttf?52m981')
|
||||
format('truetype'),
|
||||
url('{{ base_url }}/assets/fonts/icon.svg?52m981#icon')
|
||||
format('svg');
|
||||
font-family: "Icon";
|
||||
src: url({{ base_url }}/assets/fonts/icon.eot?52m981);
|
||||
src: url({{ base_url }}/assets/fonts/icon.eot?#iefix52m981)
|
||||
format("embedded-opentype"),
|
||||
url({{ base_url }}/assets/fonts/icon.woff?52m981)
|
||||
format("woff"),
|
||||
url({{ base_url }}/assets/fonts/icon.ttf?52m981)
|
||||
format("truetype"),
|
||||
url({{ base_url }}/assets/fonts/icon.svg?52m981#icon)
|
||||
format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@@ -84,30 +81,11 @@
|
||||
|
||||
<!-- Theme-related stylesheets -->
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="{{ base_url }}/assets/stylesheets/application.css" />
|
||||
href="{{ base_url }}/assets/stylesheets/application.css" />
|
||||
|
||||
<!-- Extra palettes -->
|
||||
{% if config.extra.palette %}
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="{{ base_url }}/assets/stylesheets/palettes.css" />
|
||||
{% endif %}
|
||||
|
||||
<!-- Configure webfonts -->
|
||||
{% if config.extra.font != "none" %}
|
||||
{% set text = config.extra.get("font", {}).text | default("Ubuntu") %}
|
||||
{% set code = config.extra.get("font", {}).code | default("Ubuntu Mono") %}
|
||||
{% set font = text + ':400,700|' + code | replace(' ', '+') %}
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="//fonts.googleapis.com/css?family={{ font }}" />
|
||||
<style>
|
||||
body, input {
|
||||
font-family: '{{ text }}', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
pre, code {
|
||||
font-family: '{{ code }}', 'Courier New', 'Courier', monospace;
|
||||
}
|
||||
</style>
|
||||
{% endif %}
|
||||
<!-- Web fonts -->
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="//fonts.googleapis.com/css?family=Roboto+300,400,700|Roboto+Mono" />
|
||||
|
||||
<!-- Custom stylesheets -->
|
||||
{% for path in extra_css %}
|
||||
@@ -116,158 +94,79 @@
|
||||
|
||||
<!-- Modernizr -->
|
||||
<script src="{{ base_url }}/assets/javascripts/modernizr.js"></script>
|
||||
|
||||
<!-- Custom header -->
|
||||
{% block extrahead %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<!-- Define palette -->
|
||||
{% set palette = config.extra.get("palette", {}) %}
|
||||
{% set primary = palette.primary | replace(' ', '-') | lower %}
|
||||
{% set accent = palette.accent | replace(' ', '-') | lower %}
|
||||
<body class="
|
||||
{% if primary %}palette-primary-{{ primary }}{% endif %}
|
||||
{% if accent %}palette-accent-{{ accent }}{% endif %}
|
||||
">
|
||||
|
||||
<!--
|
||||
Sadly the jinja template engine is not very flexible - it doesn't support
|
||||
regular expressions out-of-the-box. Since there might be a slash at the
|
||||
end of the repository name, we just do a string comparison and kill it.
|
||||
-->
|
||||
{% if repo_name == "GitHub" and repo_url %}
|
||||
{% set repo_id = repo_url | replace("https://github.com/", "") %}
|
||||
{% if repo_id[-1:] == "/" %}
|
||||
{% set repo_id = repo_id[:-1] %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Backdrop -->
|
||||
<div class="backdrop">
|
||||
<div class="backdrop-paper"></div>
|
||||
</div>
|
||||
<body>
|
||||
|
||||
<!-- State toggles -->
|
||||
<input class="toggle" type="checkbox" id="toggle-drawer" />
|
||||
<input class="toggle" type="checkbox" id="toggle-search" />
|
||||
<input class="md-toggle" type="checkbox" id="md-toggle-drawer" />
|
||||
<input class="md-toggle" type="checkbox" id="md-toggle-search" />
|
||||
|
||||
<!-- Overlay for expanded drawer -->
|
||||
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||
<label class="md-overlay" for="md-toggle-drawer"></label>
|
||||
|
||||
<!-- Header -->
|
||||
<header class="header">
|
||||
{% include "header.html" %}
|
||||
</header>
|
||||
<!-- Application header -->
|
||||
{% include "header.html" %}
|
||||
|
||||
<!-- Main content -->
|
||||
<main class="main">
|
||||
<!-- Container, necessary for web-application context -->
|
||||
<div class="md-container">
|
||||
|
||||
<!--
|
||||
This is a nasty hack that checks whether the content contains a
|
||||
h1 headline. If it does, the variable h1 is set to true. This is
|
||||
necessary for correctly rendering the table of contents which is
|
||||
embedded into the navigation and the actual headline.
|
||||
-->
|
||||
{% set h1 = "\x3ch1 id=" in content %}
|
||||
<!-- Main container -->
|
||||
<main class="md-main">
|
||||
<div class="md-grid md-main__inner">
|
||||
|
||||
<!-- Drawer with navigation -->
|
||||
<div class="drawer">
|
||||
{% include "drawer.html" %}
|
||||
</div>
|
||||
<!--
|
||||
This is a nasty hack that checks whether the content contains a
|
||||
h1 headline. If it does, the variable h1 is set to true. This is
|
||||
necessary for correctly rendering the table of contents which is
|
||||
embedded into the navigation and the actual headline.
|
||||
-->
|
||||
{% set h1 = "\x3ch1 id=" in content %}
|
||||
|
||||
<!-- Article -->
|
||||
<article class="article">
|
||||
<div class="wrapper">
|
||||
|
||||
<!-- Headline -->
|
||||
{% if not h1 %}
|
||||
<h1>{{ page_title | default(site_name, true)}}</h1>
|
||||
<!-- Main navigation -->
|
||||
{% if nav %}
|
||||
{% include "nav.html" %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Article content -->
|
||||
{{ content }}
|
||||
<!-- Table of contents -->
|
||||
{% if toc %}
|
||||
{% include "toc.html" %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Copyright and theme information -->
|
||||
<aside class="copyright" role="note">
|
||||
{% if copyright %}
|
||||
{{ copyright }} –
|
||||
{% endif %}
|
||||
Documentation built with
|
||||
<a href="http://www.mkdocs.org" target="_blank">MkDocs</a>
|
||||
using the
|
||||
<a href="http://squidfunk.github.io/mkdocs-material/"
|
||||
target="_blank">
|
||||
Material
|
||||
</a>
|
||||
theme.
|
||||
</aside>
|
||||
<!-- Article -->
|
||||
<div class="md-content md-content--typeset">
|
||||
<article class="md-content__inner">
|
||||
{{ content }}
|
||||
|
||||
<!-- Footer -->
|
||||
{% block footer %}
|
||||
<footer class="footer">
|
||||
{% include "footer.html" %}
|
||||
</footer>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<!-- Search results -->
|
||||
<div class="results" role="status" aria-live="polite">
|
||||
<div class="scrollable">
|
||||
<div class="wrapper">
|
||||
<div class="meta"></div>
|
||||
<div class="list"></div>
|
||||
<!-- Copyright and theme information -->
|
||||
<hr />
|
||||
<small class="md-content__copyright">
|
||||
{% if copyright %}
|
||||
{{ copyright }} –
|
||||
{% endif %}
|
||||
This document was created with
|
||||
<a href="http://www.mkdocs.org" target="_blank">MkDocs</a>
|
||||
and the
|
||||
<a href="http://squidfunk.github.io/mkdocs-material/"
|
||||
target="_blank">Material</a>
|
||||
theme.
|
||||
</small>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
|
||||
<!-- Application footer -->
|
||||
{% include "footer.html" %}
|
||||
</div>
|
||||
|
||||
<!-- Theme-related and custom javascripts -->
|
||||
<script>
|
||||
var base_url = '{{ base_url }}';
|
||||
var repo_id = '{{ repo_id }}';
|
||||
var repo_url = '{{ repo_url }}';
|
||||
</script>
|
||||
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
|
||||
{% for path in extra_javascript %}
|
||||
<script src="{{ path }}"></script>
|
||||
{% endfor %}
|
||||
|
||||
<!-- Google Analytics -->
|
||||
{% if google_analytics %}
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){
|
||||
i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||
|
||||
[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;
|
||||
m.parentNode.insertBefore(a,m)
|
||||
})(window, document,
|
||||
'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
/* General initialization */
|
||||
ga('create', '{{ google_analytics[0] }}', '{{ google_analytics[1] }}');
|
||||
ga('set', 'anonymizeIp', true);
|
||||
ga('send', 'pageview');
|
||||
|
||||
/* Track outbound links */
|
||||
var buttons = document.querySelectorAll('a');
|
||||
Array.prototype.map.call(buttons, function(item) {
|
||||
if (item.host != document.location.host) {
|
||||
item.addEventListener('click', function() {
|
||||
var action = item.getAttribute('data-action') || 'follow';
|
||||
ga('send', 'event', 'outbound', action, item.href);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/* Register handler to log search on blur */
|
||||
var query = document.querySelector('.query');
|
||||
query.addEventListener('blur', function() {
|
||||
if (this.value) {
|
||||
var path = document.location.pathname;
|
||||
ga('send', 'pageview', path + '?q=' + this.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user