Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmark feature #63

Merged
merged 2 commits into from
Jan 21, 2018
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
10 changes: 10 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,16 @@ local_search:
# show top n results per article, show all results by setting to -1
top_n_per_article: 1

# Bookmark Support
# Dependencies: https://github.com/theme-next/theme-next-bookmark
bookmark:
enable: false
# if auto
# - save the reading position when closing the page
# - or clicking the bookmark-icon
# if manual, only save it by clicking the bookmark-icon
save: auto


# ---------------------------------------------------------------
# Tags Settings
Expand Down
1 change: 1 addition & 0 deletions layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@
{% include '_third-party/pangu.swig' %}
{% include '_third-party/scroll-cookie.swig' %}
{% include '_third-party/exturl.swig' %}
{% include '_third-party/bookmark.swig' %}
</body>
</html>
11 changes: 11 additions & 0 deletions layout/_third-party/bookmark.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if theme.bookmark and theme.bookmark.enable %}
{% set bookmark_uri = url_for(theme.vendors._internal + '/bookmark/bookmark.min.js?v=1.0')%}
<script src="{{ bookmark_uri }}"></script>
<script type="text/javascript">
{% if is_post() %}
bookmark.scrollToMark('{{ theme.bookmark.save }}');
{% else %}
bookmark.loadBookmark();
{% endif %}
</script>
{% endif %}