Skip to content
This repository was archived by the owner on Aug 28, 2019. It is now read-only.

GitHub fork ribbon component #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ highlighter: pygments
gems:
- jekyll-sitemap

# GitHub Fork Ribbon

ghfr:
display: false # false to disable, null for visit, else blob/edit/custom
organization: # github organization
project: # github project
branch: # branch this website is hosted on (master/gh-pages)
text: Visit on GitHub
blob: Source on GitHub
edit: Edit on GitHub

# Site owner
owner:
Expand Down
37 changes: 37 additions & 0 deletions _includes/ghfr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% unless ghfr_display == false %}
{% if page.ghfr.style %}
{% assign ghfr_style = page.ghfr.style %}
{% elsif site.ghfr.style %}
{% assign ghfr_style = site.ghfr.style %}
{% endif %}
{% if page.ghfr.class %}
{% assign ghfr_class = page.ghfr.class %}
{% elsif site.ghfr.class %}
{% assign ghfr_class = site.ghfr.class %}
{% else %}
{% assign ghfr_class = 'left' %}
{% endif %}
{% if page.ghfr.text %}
{% assign ghfr_text = page.ghfr.text %}
{% elsif site.ghfr[ghfr_display] %}
{% assign ghfr_text = site.ghfr[ghfr_display] %}
{% else %}
{% assign ghfr_text = site.ghfr.text %}
{% endif %}
{% if ghfr_display == null %}
{% if page.ghfr.link %}
{% assign ghfr_link = page.ghfr.link %}
{% elsif site.ghfr.link %}
{% assign ghfr_link = site.ghfr.link %}
{% else %}
{% capture ghfr_link %}https://github.com/{{ site.ghfr.organization }}/{{ site.ghfr.project }}{% endcapture %}
{% endif %}
{% else %}
{% capture ghfr_link %}https://github.com/{{ site.ghfr.organization}}/{{ site.ghfr.project }}/{{ ghfr_display }}/{{ site.ghfr.branch }}/{{ page.path }}{% endcapture %}
{% endif %}
<div class="github-fork-ribbon-wrapper {{ ghfr_class }}">
<div class="github-fork-ribbon"{% if ghfr_style %} style="{{ ghfr_style }}"{% endif %}>
<a href="{{ ghfr_link }}">{{ ghfr_text }}</a>
</div>
</div>
{% endunless %}
14 changes: 14 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
<meta http-equiv="cleartype" content="on">

<link rel="stylesheet" href="{{ site.url }}/css/main.css">

{% if page.ghfr.display != null %}
{% assign ghfr_display = page.ghfr.display %}
{% else %}
{% assign ghfr_display = site.ghfr.display %}
{% endif %}
{% unless ghfr_display == false %}
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.1.1/gh-fork-ribbon.min.css" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.1.1/gh-fork-ribbon.ie.min.css" />
<![endif]-->
{% endunless %}

<!-- HTML5 Shiv and Media Query Support for IE -->
<!--[if lt IE 9]>
<script src="{{ site.url }}/js/vendor/html5shiv.min.js"></script>
Expand All @@ -31,6 +44,7 @@

<body id="js-body">
{% include browser-upgrade.html %}
{% include ghfr.html %}
{% include header.html %}
{% include navigation-sliding.html %}

Expand Down
3 changes: 3 additions & 0 deletions _sass/_ghfr.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github-fork-ribbon-wrapper {
z-index: 19 !important;
}
1 change: 1 addition & 0 deletions css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ sitemap: false
@import "toc"; /* table of contents */
@import "breadcrumbs";
@import "syntax";
@import "ghfr";

/*
Page specific
Expand Down