Skip to content

Commit

Permalink
Feat: Add quicklink support (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
1v9 authored and ivan-nginx committed Feb 23, 2019
1 parent f4b967e commit 664377b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
11 changes: 11 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ han: false
# For more information: https://github.com/vinta/pangu.js
pangu: false

# quicklink Support
# Dependencies: https://cdn.jsdelivr.net/npm/quicklink/dist/
# Visit https://github.com/GoogleChromeLabs/quicklink for details
quicklink: false

# Swiftype Search API Key
#swiftype_key:

Expand Down Expand Up @@ -1012,6 +1017,12 @@ vendors:
# pangu: //cdnjs.cloudflare.com/ajax/libs/pangu/3.3.0/pangu.min.js
pangu:

# Internal version: 1.0.0
# See: https://github.com/GoogleChromeLabs/quicklink
# Example:
# quicklink: //cdn.jsdelivr.net/npm/[email protected]/dist/quicklink.umd.js
quicklink:

# Internal version: 1.0.0
# See: https://github.com/revir/need-more-share2
# Example:
Expand Down
2 changes: 1 addition & 1 deletion layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
{% block script_extra %}{% endblock %}

{% include '_scripts/boostrap.swig' %}

{% include '_third-party/quicklink.swig' %}
{% include '_third-party/comments/index.swig' %}
{% include '_third-party/search/index.swig' %}
{% include '_third-party/analytics/lean-analytics.swig' %}
Expand Down
17 changes: 17 additions & 0 deletions layout/_third-party/quicklink.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if theme.quicklink %}
{% set quicklink_uri = url_for(theme.vendors._internal + '/quicklink/dist/quicklink.umd.js') %}
{% if theme.vendors.quicklink %}
{% set quicklink_uri = theme.vendors.quicklink %}
{% endif %}
<script src="{{ quicklink_uri }}"></script>
<script>
window.addEventListener('load', () => {
quicklink({
priority: true,
ignores: [
uri => uri.includes('#')
]
});
});
</script>
{% endif %}

0 comments on commit 664377b

Please sign in to comment.