From 9b86e292fa1860820ede6531ed494c97ea6db444 Mon Sep 17 00:00:00 2001 From: Matthew Wang Date: Sun, 12 Jan 2020 13:47:05 -0800 Subject: [PATCH] implements requested branch and edit mode configs --- _config.yml | 6 ++++-- _layouts/default.html | 11 +++++++++-- docs/configuration.md | 12 ++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/_config.yml b/_config.yml index 721cc74..4850575 100644 --- a/_config.yml +++ b/_config.yml @@ -42,9 +42,11 @@ aux_links: footer_content: "Copyright © 2017-2019 Patrick Marsceill. Distributed by an MIT license." # Footer metadata show_last_edit_time: true -last_edit_time_format: "%b %e %Y at %I:%M %p" +last_edit_time_format: "%b %e %Y at %I:%M %p" # uses ruby's time format: https://ruby-doc.org/stdlib-2.7.0/libdoc/time/rdoc/Time.html show_gh_edit_link: true -gh_edit_repository: "https://github.com/pmarsceill/just-the-docs" +gh_edit_repository: "https://github.com/pmarsceill/just-the-docs" # the github URL for your repo +gh_edit_branch: "master" # switch to the branch that your docs is served from +gh_edit_view_mode: "tree" # switch to "edit" if you want the user to jump into the editor immediately edit_link_text: "Edit this page on GitHub." # Color scheme currently only supports "dark" or nil (default) diff --git a/_layouts/default.html b/_layouts/default.html index 4496d9d..86f7469 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -94,9 +94,16 @@ layout: table_wrappers Page last modified: {{ page.last_modified_date | date: site.last_edit_time_format }}.

{% endif %} - {% if site.show_gh_edit_link and site.edit_link_text %} + {% + if + site.show_gh_edit_link and + site.edit_link_text and + site.gh_edit_repository and + site.gh_edit_view_mode and + site.gh_edit_branch + %}

- {{ site.edit_link_text }} + {{ site.edit_link_text }}

{% endif %} {% if site.footer_content != nil %} diff --git a/docs/configuration.md b/docs/configuration.md index 86dd7eb..74a0d0c 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -67,15 +67,19 @@ heading_anchors: true footer_content: "Copyright © 2017-2019 Patrick Marsceill. Distributed by an MIT license." # Footer metadata show_last_edit_time: true -last_edit_time_format: "%b %e %Y at %I:%M %p" +last_edit_time_format: "%b %e %Y at %I:%M %p" # uses ruby's time format show_gh_edit_link: true -gh_edit_repository: "https://github.com/pmarsceill/just-the-docs" -edit_link_text: "Edit this page on GitHub" +gh_edit_repository: "https://github.com/pmarsceill/just-the-docs" # the github URL for your repo +gh_edit_branch: "master" # switch to the branch that your docs is served from +gh_edit_view_mode: "tree" # switch to "edit" if you want the user to jump into the editor immediately +edit_link_text: "Edit this page on GitHub." ``` * the "page last modified" data will only display if a page has a key called `last_modified_date`, formatted in some readable date format * `last_edit_time_format` uses Ruby's DateTime formatter; see examples and more information [at this link.](https://apidock.com/ruby/DateTime/strftime) -* `gh_edit_repository` should be changed to the project's GitHub repository +* `gh_edit_repository` is the URL of the project's GitHub repository +* `gh_edit_branch` is the branch that the docs site is served from; defaults to `master` +* `gh_edit_view_mode` is `"tree"` by default, which brings the user to the github page; switch to `"edit"` to bring the user directly into editing mode ## Color scheme