Skip to content

Commit

Permalink
Merge pull request mmistakes#334 from CodeSandwich/custom_header_footer
Browse files Browse the repository at this point in the history
Add custom header and footer include files
  • Loading branch information
pmarsceill committed Oct 12, 2020
2 parents bb1cd2a + fdb9375 commit bd1f741
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions _includes/footer_custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- if site.footer_content -%}
<p class="text-small text-grey-dk-100 mb-0">{{ site.footer_content }}</p>
{%- endif -%}
Empty file added _includes/header_custom.html
Empty file.
11 changes: 7 additions & 4 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<div id="search-results" class="search-results"></div>
</div>
{% endif %}
{% include header_custom.html %}
{% if site.aux_links %}
<nav aria-label="Auxiliary" class="aux-nav">
<ul class="aux-nav-list">
Expand Down Expand Up @@ -149,15 +150,17 @@ <h2 class="text-delta">Table of contents</h2>
</ul>
{% endif %}

{% if site.footer_content != nil or site.last_edit_timestamp or site.gh_edit_link %}
{% capture footer_custom %}
{%- include footer_custom.html -%}
{% endcapture %}
{% if footer_custom != "" or site.last_edit_timestamp or site.gh_edit_link %}
<hr>
<footer>
{% if site.back_to_top %}
<p><a href="#top" id="back-to-top">{{ site.back_to_top_text }}</a></p>
{% endif %}
{% if site.footer_content != nil %}
<p class="text-small text-grey-dk-000 mb-0">{{ site.footer_content }}</p>
{% endif %}

{{ footer_custom }}

{% if site.last_edit_timestamp or site.gh_edit_link %}
<div class="d-flex mt-2">
Expand Down
7 changes: 6 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ heading_anchors: true
## Footer content
```yaml
# Footer content
# Footer content
# appears at the bottom of every page's main content
footer_content: "Copyright &copy; 2017-2019 Patrick Marsceill. Distributed by an <a href=\"https://github.com/pmarsceill/just-the-docs/tree/master/LICENSE.txt\">MIT license.</a>"

Note: This option is deprecated and will be removed in a future major release. Please use `_includes/footer_custom.html` for more robust
markup / liquid-based content.

# Footer last edited timestamp
last_edit_timestamp: true # show or hide edit time - page must have `last_modified_date` defined in the frontmatter
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
Expand All @@ -104,6 +107,8 @@ gh_edit_branch: "master" # the branch that your docs is served from
gh_edit_view_mode: "tree" # "tree" or "edit" if you want the user to jump into the editor immediately
```
_note: `footer_content` is deprecated, but still supported. For a better experience we have moved this into an include called `_includes/footer_custom.html` which will allow for robust markup / liquid-based content._

- 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` is the URL of the project's GitHub repository
Expand Down

0 comments on commit bd1f741

Please sign in to comment.