mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-12 01:50:52 +01:00
Refactored and cleaned up partials
This commit is contained in:
parent
eb6aedf5cc
commit
d52f605200
@ -35,11 +35,11 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="md-flex__cell md-flex__cell--shrink">
|
||||
<div class="md-header-nav__source">
|
||||
{% if config.repo_url %}
|
||||
{% include "partials/source.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="md-header-nav__source">
|
||||
{% if config.repo_url %}
|
||||
{% include "partials/source.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -1,13 +1,25 @@
|
||||
{% if nav_item.is_homepage %}
|
||||
<li class="md-tabs__item">
|
||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-tabs__link {% for nav_item_ in nav %} {% if nav_item_.url == page.url %} md-tabs__link--active {% endif %} {% endfor %}">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% if not page.ancestors | length and nav | selectattr("url", page.url) %}
|
||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-tabs__link md-tabs__link--active">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-tabs__link">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% elif nav_item.children and nav_item.children | length > 0 %}
|
||||
<li class="md-tabs__item">
|
||||
<a href="{{ (nav_item.children | first).url }}" title="{{ nav_item.title }}" class="md-tabs__link {% if nav_item.active %} md-tabs__link--active {% endif %}">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% if nav_item.active %}
|
||||
<a href="{{ (nav_item.children | first).url }}" title="{{ nav_item.title }}" class="md-tabs__link md-tabs__link--active">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ (nav_item.children | first).url }}" title="{{ nav_item.title }}" class="md-tabs__link">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -1,4 +1,8 @@
|
||||
<nav class="md-tabs {% if page.ancestors | length > 0 %} md-tabs--active {% endif %}" data-md-component="tabs">
|
||||
{% set class = "md-tabs" %}
|
||||
{% if page.ancestors | length > 0 %}
|
||||
{% set class = "md-tabs md-tabs--active" %}
|
||||
{% endif %}
|
||||
<nav class="{{ class }}" data-md-component="tabs">
|
||||
<div class="md-tabs__inner md-grid">
|
||||
<ul class="md-tabs__list">
|
||||
{% for nav_item in nav %}
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
<!-- Generator banner -->
|
||||
<meta name="generator"
|
||||
content="mkdocs-{{ mkdocs_version }}, $theme-name$-$theme-version$" />
|
||||
content="mkdocs-{{ mkdocs_version }}, $theme-name$-$theme-version$" />
|
||||
{% endblock %}
|
||||
|
||||
<!-- Block: site title -->
|
||||
@ -96,7 +96,7 @@
|
||||
| default("Roboto Mono") %}
|
||||
{% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %}
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="https://fonts.googleapis.com/css?family={{ font }}" />
|
||||
href="https://fonts.googleapis.com/css?family={{ font }}" />
|
||||
<style>
|
||||
body, input {
|
||||
font-family: "{{ text }}", "Helvetica Neue",
|
||||
|
@ -77,11 +77,11 @@
|
||||
|
||||
<!-- Repository containing source -->
|
||||
<div class="md-flex__cell md-flex__cell--shrink">
|
||||
<div class="md-header-nav__source">
|
||||
{% if config.repo_url %}
|
||||
{% include "partials/source.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="md-header-nav__source">
|
||||
{% if config.repo_url %}
|
||||
{% include "partials/source.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
<!-- Main navigation -->
|
||||
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||
|
||||
<!-- Site title -->
|
||||
<label class="md-nav__title md-nav__title--site" for="drawer">
|
||||
{% if config.extra.logo %}
|
||||
<i class="md-logo md-nav__button">
|
||||
@ -32,11 +34,15 @@
|
||||
{% endif %}
|
||||
{{ config.site_name }}
|
||||
</label>
|
||||
|
||||
<!-- Repository containing source -->
|
||||
{% if config.repo_url %}
|
||||
<div class="md-nav__source">
|
||||
{% include "partials/source.html" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Render item list -->
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
{% for nav_item in nav %}
|
||||
{% set path = "nav-" + loop.index | string %}
|
||||
|
@ -23,26 +23,33 @@
|
||||
<!-- Home page -->
|
||||
{% if nav_item.is_homepage %}
|
||||
<li class="md-tabs__item">
|
||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
|
||||
class="md-tabs__link
|
||||
{% for nav_item_ in nav %}
|
||||
{% if nav_item_.url == page.url %}
|
||||
md-tabs__link--active
|
||||
{% endif %}
|
||||
{% endfor %}">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% if not page.ancestors | length and nav | selectattr("url", page.url) %}
|
||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
|
||||
class="md-tabs__link md-tabs__link--active">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
|
||||
class="md-tabs__link">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
<!-- Main navigation item with nested items -->
|
||||
{% elif nav_item.children and nav_item.children | length > 0 %}
|
||||
<li class="md-tabs__item">
|
||||
<a href="{{ (nav_item.children | first).url }}"
|
||||
title="{{ nav_item.title }}" class="md-tabs__link
|
||||
{% if nav_item.active %}
|
||||
md-tabs__link--active
|
||||
{% endif %}">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% if nav_item.active %}
|
||||
<a href="{{ (nav_item.children | first).url }}"
|
||||
title="{{ nav_item.title }}"
|
||||
class="md-tabs__link md-tabs__link--active">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ (nav_item.children | first).url }}"
|
||||
title="{{ nav_item.title }}" class="md-tabs__link">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -20,12 +20,14 @@
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<!-- Tabs with outline (level denotes the active level) -->
|
||||
<nav class="md-tabs
|
||||
{% if page.ancestors | length > 0 %}
|
||||
md-tabs--active
|
||||
{% endif %}"
|
||||
data-md-component="tabs">
|
||||
<!-- Determine class according to level -->
|
||||
{% set class = "md-tabs" %}
|
||||
{% if page.ancestors | length > 0 %}
|
||||
{% set class = "md-tabs md-tabs--active" %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Tabs with outline -->
|
||||
<nav class="{{ class }}" data-md-component="tabs">
|
||||
<div class="md-tabs__inner md-grid">
|
||||
<ul class="md-tabs__list">
|
||||
{% for nav_item in nav %}
|
||||
|
Loading…
Reference in New Issue
Block a user