Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ extra:
logo: 'images/logo.png'
```

### Link to GitHub releases page

If your project has a GitHub url configured, the default behavior is that a
downlink button is displayed, linking to the source download of the given
`extra.version` or `master` branch. To link to the releases page instead,
set `extra.github.download_release` to `true`. It will link to the release of
the given `extra.version` or when no `extra.version` is given, the latest
release:

``` yaml
repo_name: GitHub
repo_url: https://github.com/squidfunk/mkdocs-material

extra:
github:
download_release: true
```


### Changing the color palette

Material defines a default hue for every primary and accent color on Google's
Expand Down
15 changes: 11 additions & 4 deletions material/drawer.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@
{% if repo_name == "GitHub" and repo_url %}
<ul class="repo">
<li class="repo-download">
{% set version = config.extra.version | default("master") %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% if config.extra.github and config.extra.github.download_release %}
{% set version = config.extra.version | default("../latest") %}
<a href="{{ repo_url }}/releases/tag/{{ version }}" target="_blank" title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% else %}
{% set version = config.extra.version | default("master") %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% endif %}
</li>
<li class="repo-stars">
<a href="{{ repo_url }}/stargazers" target="_blank" title="Stargazers" data-action="star">
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ theme_dir: material
extra:
version: 0.2.4
logo: images/logo.png
github:
download_release: true
author:
github: squidfunk
twitter: squidfunk
Expand Down
18 changes: 13 additions & 5 deletions src/drawer.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@
{% if repo_name == "GitHub" and repo_url %}
<ul class="repo">
<li class="repo-download">
{% set version = config.extra.version | default("master") %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank"
title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% if config.extra.github and config.extra.github.download_release %}
{% set version = config.extra.version | default("../latest") %}
<a href="{{ repo_url }}/releases/tag/{{ version }}" target="_blank"
title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% else %}
{% set version = config.extra.version | default("master") %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank"
title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% endif %}
</li>
<li class="repo-stars">
<a href="{{ repo_url }}/stargazers" target="_blank"
Expand Down