1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-30 18:24:35 +01:00

Add option to link to GitHub release.

This commit is contained in:
Orne Brocaar 2016-06-29 18:14:25 +02:00
parent 57f51f3a3d
commit 56d252c6bb
4 changed files with 45 additions and 9 deletions

View File

@ -103,6 +103,25 @@ extra:
logo: 'images/logo.png' 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 ### Changing the color palette
Material defines a default hue for every primary and accent color on Google's Material defines a default hue for every primary and accent color on Google's

View File

@ -26,10 +26,17 @@
{% if repo_name == "GitHub" and repo_url %} {% if repo_name == "GitHub" and repo_url %}
<ul class="repo"> <ul class="repo">
<li class="repo-download"> <li class="repo-download">
{% set version = config.extra.version | default("master") %} {% if config.extra.github.download_release %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" title="Download" data-action="download"> {% set version = config.extra.version | default("../latest") %}
<i class="icon icon-download"></i> Download <a href="{{ repo_url }}/releases/tag/{{ version }}" target="_blank" title="Download" data-action="download">
</a> <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>
<li class="repo-stars"> <li class="repo-stars">
<a href="{{ repo_url }}/stargazers" target="_blank" title="Stargazers" data-action="star"> <a href="{{ repo_url }}/stargazers" target="_blank" title="Stargazers" data-action="star">

View File

@ -38,6 +38,8 @@ theme_dir: material
extra: extra:
version: 0.2.4 version: 0.2.4
logo: images/logo.png logo: images/logo.png
github:
download_release: true
author: author:
github: squidfunk github: squidfunk
twitter: squidfunk twitter: squidfunk

View File

@ -41,11 +41,19 @@
{% if repo_name == "GitHub" and repo_url %} {% if repo_name == "GitHub" and repo_url %}
<ul class="repo"> <ul class="repo">
<li class="repo-download"> <li class="repo-download">
{% set version = config.extra.version | default("master") %} {% if config.extra.github.download_release %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" {% set version = config.extra.version | default("../latest") %}
title="Download" data-action="download"> <a href="{{ repo_url }}/releases/tag/{{ version }}" target="_blank"
<i class="icon icon-download"></i> Download title="Download" data-action="download">
</a> <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>
<li class="repo-stars"> <li class="repo-stars">
<a href="{{ repo_url }}/stargazers" target="_blank" <a href="{{ repo_url }}/stargazers" target="_blank"