-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to specify custom icon images
- Loading branch information
Showing
8 changed files
with
185 additions
and
42 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletions
18
src/pydata_sphinx_theme/theme/pydata_sphinx_theme/icon-links.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
{%- macro icon_link_nav_item(url, icon, name) -%} | ||
{%- macro icon_link_nav_item(url, icon, name, type) -%} | ||
{%- if url | length > 2 %} | ||
<li class="nav-item"> | ||
<a class="nav-link" href="{{ url }}" rel="noopener" target="_blank" title="{{ _(name) }}"> | ||
{%- if type == "fontawesome" -%} | ||
<span><i class="{{ icon }}"></i></span> | ||
<label class="sr-only">{{ _(name) }}</label> | ||
{%- elif type == "local" -%} | ||
<img src="{{ pathto(icon, 1) }}" class="icon-link-image" alt="{{ _(name) }}"/> | ||
{%- else %} | ||
<span>Incorrectly configured icon link. Type must by `fontawesome` or `local`.</span> | ||
{%- endif -%} | ||
</a> | ||
</li> | ||
{%- endif -%} | ||
{%- endmacro -%} | ||
|
||
<ul id="navbar-icon-links" class="navbar-nav" aria-label="{{ _(theme_icon_links_label) }}"> | ||
{%- block icon_link_shortcuts -%} | ||
{{ icon_link_nav_item(theme_github_url, "fab fa-github-square", "GitHub") -}} | ||
{{ icon_link_nav_item(theme_gitlab_url, "fab fa-gitlab", "GitLab") -}} | ||
{{ icon_link_nav_item(theme_bitbucket_url, "fab fa-bitbucket", "Bitbucket") -}} | ||
{{ icon_link_nav_item(theme_twitter_url, "fab fa-twitter-square", "Twitter") -}} | ||
{{ icon_link_nav_item(theme_github_url, "fab fa-github-square", "GitHub", "fontawesome") -}} | ||
{{ icon_link_nav_item(theme_gitlab_url, "fab fa-gitlab", "GitLab", "fontawesome") -}} | ||
{{ icon_link_nav_item(theme_bitbucket_url, "fab fa-bitbucket", "Bitbucket", "fontawesome") -}} | ||
{{ icon_link_nav_item(theme_twitter_url, "fab fa-twitter-square", "Twitter", "fontawesome") -}} | ||
{% endblock -%} | ||
{%- for icon_link in theme_icon_links -%} | ||
{{ icon_link_nav_item(icon_link["url"], icon_link["icon"], icon_link["name"]) -}} | ||
{{ icon_link_nav_item(icon_link["url"], icon_link["icon"], icon_link["name"], icon_link.get("type", "fontawesome")) -}} | ||
{%- endfor %} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<ul aria-label="Icon Links" class="navbar-nav" id="navbar-icon-links"> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://site1.org" rel="noopener" target="_blank" title="FONTAWESOME"> | ||
<span> | ||
<i class="FACLASS"> | ||
</i> | ||
</span> | ||
<label class="sr-only"> | ||
FONTAWESOME | ||
</label> | ||
</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://site2.org" rel="noopener" target="_blank" title="FONTAWESOME DEFAULT"> | ||
<span> | ||
<i class="FADEFAULTCLASS"> | ||
</i> | ||
</span> | ||
<label class="sr-only"> | ||
FONTAWESOME DEFAULT | ||
</label> | ||
</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://site3.org" rel="noopener" target="_blank" title="LOCAL FILE"> | ||
<img alt="LOCAL FILE" class="icon-link-image" src="emptylogo.png"/> | ||
</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="https://site4.org" rel="noopener" target="_blank" title="WRONG TYPE"> | ||
<span> | ||
Incorrectly configured icon link. Type must by `fontawesome` or `local`. | ||
</span> | ||
</a> | ||
</li> | ||
</ul> |