Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Thanks Kevin!

- split up adding `.DS_Store` to `.gitignore`
- conditionally add search icons only if search is enabled
- fix parent/grandparent structure computation for minimal layout
- fix unbalanced indentation in minimal layout

Co-authored-by: Kevin Lin <hello@kevinl.info>
  • Loading branch information
mattxwang and kevinlin1 authored Dec 26, 2022
1 parent 93cc3f0 commit bf8a742
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
_site
Gemfile.lock
node_modules
.DS_Store
6 changes: 4 additions & 2 deletions _includes/icons/icons.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
{% include icons/link.html %}
{% include icons/search.html %}
{% include icons/menu.html %}
{% include icons/expand.html %}
{% include icons/document.html %}
{% include icons/external_link.html %}
{% if site.search_enabled != false %}
{% include icons/document.html %}
{% include icons/search.html %}
{% endif %}
</svg>
46 changes: 32 additions & 14 deletions _layouts/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,42 @@
<body>
<a class="skip-to-main" href="#main-content">Skip to main content</a>
{% include icons/icons.html %}

<div class="main" id="top">
<div id="main-content-wrap" class="main-content-wrap">
{% include components/breadcrumbs.html %}
<div id="main-content" class="main-content" role="main">
{% if site.heading_anchors != false %}
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
{% else %}
{{ content }}
{% capture nav %}
{% assign pages_top_size = site.html_pages
| where_exp:"item", "item.title != nil"
| where_exp:"item", "item.parent == nil"
| where_exp:"item", "item.nav_exclude != true"
| size %}
{% if pages_top_size > 0 %}
{% include nav.html pages=site.html_pages key=nil %}
{% endif %}
{% if site.just_the_docs.collections %}
{% assign collections_size = site.just_the_docs.collections | size %}
{% for collection_entry in site.just_the_docs.collections %}
{% assign collection_key = collection_entry[0] %}
{% assign collection_value = collection_entry[1] %}
{% assign collection = site[collection_key] %}
{% if collection_value.nav_exclude != true %}
{% include nav.html pages=collection key=collection_key %}
{% endif %}
{% endfor %}
{% endif %}
{% endcapture %}
<div id="main-content-wrap" class="main-content-wrap" id="top">
{% include components/breadcrumbs.html %}
<div id="main-content" class="main-content" role="main">
{% if site.heading_anchors != false %}
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#svg-link\"></use></svg>" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
{% else %}
{{ content }}
{% endif %}

{% if page.has_children == true and page.has_toc != false %}
{% include components/children_nav.html %}
{% endif %}
{% if page.has_children == true and page.has_toc != false %}
{% include components/children_nav.html %}
{% endif %}

{% include components/footer.html %}
{% include components/footer.html %}

</div>
</div>
</div>

Expand Down

0 comments on commit bf8a742

Please sign in to comment.