Added breadcrumbs in header

This commit is contained in:
squidfunk 2016-12-15 20:04:30 +01:00
parent 420b841ecf
commit 3a73abad08
6 changed files with 35 additions and 9 deletions

View File

@ -27,6 +27,7 @@ site_url: http://squidfunk.github.io/mkdocs-material/
# Repository
repo_name: squidfunk/mkdocs-material
repo_url: https://github.com/squidfunk/mkdocs-material
edit_uri: edit/master/docs/
# Copyright
copyright: 'Copyright &copy 2016 Martin Donath'

View File

@ -100,6 +100,23 @@
line-height: 4.8rem;
}
// Parent page title
&__parent {
color: $md-color-white--light;
// Ancestor separator
&::after {
display: inline;
color: $md-color-white--lighter;
content: "/";
}
// [mobile portrait -]: Hide on very small screens
@include break-to-device(mobile portrait) {
display: none;
}
}
// Repository containing source
&__source {
display: none;

View File

@ -34,8 +34,8 @@
// [tablet landscape +]: Header-embedded search
@include break-from-device(tablet landscape) {
margin-right: 2.8rem;
padding: 0.4rem;
padding-right: 3.2rem;
}
// Search modal overlay

View File

@ -153,8 +153,9 @@
{% block content %}
<!-- Edit button, if URL was defined -->
{% if edit_uri %}
<a class="md-button md-button--edit" href="{{ edit_uri }}">
{% if config.edit_uri %}
<a class="md-button md-button--edit"
href="{{ page.edit_url }}">
Edit
</a>
{% endif %}

View File

@ -46,7 +46,14 @@
<!-- Header title -->
<div class="md-flex__cell md-flex__cell--stretch">
<span class="md-flex__ellipsis md-header-nav__title">
{%- block site_name -%}
{% block site_name %}
{% if page %}
{% for parent in page.ancestors %}
<span class="md-header-nav__parent">
{{ parent.title }}
</span>
{% endfor %}
{% endif %}
{{ page.title | default(config.site_name, true) }}
{% endblock %}
</span>
@ -54,9 +61,9 @@
<!-- Button to open search dialogue -->
<div class="md-flex__cell md-flex__cell--shrink">
{%- block search_box -%}
<label class="md-icon md-header-nav__icon md-header-nav__icon--search"
for="search">
{% block search_box %}
<label class="md-icon md-header-nav__icon
md-header-nav__icon--search" for="search">
search
</label>
@ -68,7 +75,7 @@
<!-- Repository containing source -->
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
{%- block repo -%}
{% block repo %}
{% if config.repo_url %}
{% include "partials/source.html" %}
{% endif %}

View File

@ -43,6 +43,6 @@
<a href="{{ config.repo_url }}" title="Go to repository"
class="md-source {{ repo_icon }}" data-md-source="{{ repo_type }}"> <!-- use <> for custom / private repo -->
<div class="md-source__repository">
{{ repo_name }}
{{ config.repo_name }}
</div>
</a>