From 68066ce268f2114ca9337551f69553fcf1028744 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Tue, 25 Feb 2020 05:14:11 +0530 Subject: [PATCH] Optimize rendering of the documentation site (#8020) Merge pull request 8020 --- docs/_includes/analytics.html | 5 +- docs/_includes/docs_contents.html | 18 ++--- docs/_includes/docs_contents_mobile.html | 16 ++-- docs/_includes/docs_variables_table.html | 4 +- docs/_includes/header.html | 14 ++-- docs/_includes/mobile-nav-items.html | 24 +++--- docs/_includes/news_contents.html | 20 ++--- docs/_includes/news_contents_mobile.html | 4 +- docs/_includes/news_item.html | 12 +-- docs/_includes/primary-nav-items.html | 16 ++-- docs/_includes/section_nav_tutorials.html | 62 +++++++-------- docs/_includes/step-index.html | 77 ++++++------------- docs/_includes/tutorials_contents.html | 18 +++-- docs/_includes/tutorials_contents_mobile.html | 10 ++- docs/_includes/tutorials_option.html | 5 -- docs/_includes/tutorials_ul.html | 7 -- docs/_layouts/default.html | 14 ++-- docs/_layouts/docs.html | 36 ++++----- docs/_layouts/news.html | 23 +++--- docs/_layouts/news_item.html | 10 +-- docs/_layouts/page.html | 3 - docs/_layouts/step.html | 39 ++++------ docs/_layouts/tutorials.html | 39 ++++------ docs/pages/404.html | 16 +--- docs/pages/news.html | 6 +- docs/pages/releases.html | 6 +- docs/pages/showcase.html | 24 +++--- 27 files changed, 226 insertions(+), 302 deletions(-) delete mode 100644 docs/_includes/tutorials_option.html delete mode 100644 docs/_includes/tutorials_ul.html diff --git a/docs/_includes/analytics.html b/docs/_includes/analytics.html index 81c8286a..5d0e9c4b 100644 --- a/docs/_includes/analytics.html +++ b/docs/_includes/analytics.html @@ -1,4 +1,4 @@ -{% if site.google_analytics_id %} +{% if site.google_analytics_id -%} -{% endif %} +{% endif -%} diff --git a/docs/_includes/docs_contents.html b/docs/_includes/docs_contents.html index d99e8223..4c004fe2 100644 --- a/docs/_includes/docs_contents.html +++ b/docs/_includes/docs_contents.html @@ -1,17 +1,15 @@
diff --git a/docs/_includes/docs_contents_mobile.html b/docs/_includes/docs_contents_mobile.html index 8739a9c9..5df8039f 100644 --- a/docs/_includes/docs_contents_mobile.html +++ b/docs/_includes/docs_contents_mobile.html @@ -1,15 +1,15 @@
diff --git a/docs/_includes/docs_variables_table.html b/docs/_includes/docs_variables_table.html index df5e9b17..feafa710 100644 --- a/docs/_includes/docs_variables_table.html +++ b/docs/_includes/docs_variables_table.html @@ -7,12 +7,12 @@ - {% for var in include.scope %} + {% for var in include.scope -%}

{{ var.name }}

{{- var.description -}}

- {% endfor %} + {% endfor -%} diff --git a/docs/_includes/header.html b/docs/_includes/header.html index 418e04d5..b38a89ec 100644 --- a/docs/_includes/header.html +++ b/docs/_includes/header.html @@ -9,23 +9,19 @@
diff --git a/docs/_includes/mobile-nav-items.html b/docs/_includes/mobile-nav-items.html index fc8f10ef..6b9b0062 100644 --- a/docs/_includes/mobile-nav-items.html +++ b/docs/_includes/mobile-nav-items.html @@ -1,18 +1,14 @@ diff --git a/docs/_includes/news_contents.html b/docs/_includes/news_contents.html index 737a2114..d717b20d 100644 --- a/docs/_includes/news_contents.html +++ b/docs/_includes/news_contents.html @@ -10,24 +10,24 @@

Recent Releases

Other News

diff --git a/docs/_includes/news_contents_mobile.html b/docs/_includes/news_contents_mobile.html index 8f8ba563..3f8c18f7 100644 --- a/docs/_includes/news_contents_mobile.html +++ b/docs/_includes/news_contents_mobile.html @@ -3,9 +3,9 @@ - {% for post in site.posts %} + {% for post in site.posts -%} - {% endfor %} + {% endfor -%} diff --git a/docs/_includes/news_item.html b/docs/_includes/news_item.html index db490c8e..e7a7dbc2 100644 --- a/docs/_includes/news_item.html +++ b/docs/_includes/news_item.html @@ -1,25 +1,25 @@

- {{ post.title }} + {{- post.title -}}

- {{ post.content }} + {{- post.content -}}
diff --git a/docs/_includes/primary-nav-items.html b/docs/_includes/primary-nav-items.html index b27cceb6..eb30a699 100644 --- a/docs/_includes/primary-nav-items.html +++ b/docs/_includes/primary-nav-items.html @@ -1,13 +1,11 @@ diff --git a/docs/_includes/section_nav_tutorials.html b/docs/_includes/section_nav_tutorials.html index 30812bba..8d665f51 100644 --- a/docs/_includes/section_nav_tutorials.html +++ b/docs/_includes/section_nav_tutorials.html @@ -1,39 +1,39 @@ -{% comment %} +{%- comment -%} Map grabs the tutorials sections, giving us an array of arrays. Join, flattens all the items to a comma delimited string. Split turns it into an array again. -{% endcomment %} -{% assign tutorials = site.data.tutorials | map: 'tutorials' | join: ',' | split: ',' %} +{%- endcomment -%} +{%- assign tutorials = site.data.tutorials | map: 'tutorials' | join: ',' | split: ',' -%} -{% comment %} +{%- comment -%} Because this is built for every page, lets find where we are in the ordered document list by comparing url strings. Then if there's something previous or next, lets build a link to it. -{% endcomment %} +{%- endcomment -%} -{% for tutorial in tutorials %} - {% assign tutorial_url = tutorial | prepend:"/tutorials/" | append:"/" %} - {% if tutorial_url == page.url %} -
-
- {% if forloop.first %} - Back - {% else %} - {% assign previous = forloop.index0 | minus: 1 %} - {% assign previous_page = tutorials[previous] | prepend:"/tutorials/" | append:"/" %} - - {% endif %} -
-
- {% if forloop.last %} - Next - {% else %} - {% assign next = forloop.index0 | plus: 1 %} - {% assign next_page = tutorials[next] | prepend:"/tutorials/" | append:"/" %} - - {% endif %} -
+{% for tutorial in tutorials -%} + {% assign tutorial_url = tutorial | prepend:"/tutorials/" | append:"/" -%} + {% if tutorial_url == page.url -%} +
+
+ {% if forloop.first -%} + Back + {% else -%} + {% assign previous = forloop.index0 | minus: 1 -%} + {% assign previous_page = tutorials[previous] | prepend:"/tutorials/" | append:"/" -%} + + {% endif -%}
-
- {% break %} - {% endif %} -{% endfor %} \ No newline at end of file +
+ {% if forloop.last -%} + Next + {% else -%} + {% assign next = forloop.index0 | plus: 1 -%} + {% assign next_page = tutorials[next] | prepend:"/tutorials/" | append:"/" -%} + + {% endif -%} +
+
+
+ {% break -%} + {% endif -%} +{% endfor -%} diff --git a/docs/_includes/step-index.html b/docs/_includes/step-index.html index eb03b551..798fb7c5 100644 --- a/docs/_includes/step-index.html +++ b/docs/_includes/step-index.html @@ -1,65 +1,34 @@ -{% assign docs = site.docs | where_exp: "doc", "doc.url contains '/step-by-step/'" %} +{% assign docs = site.docs | where_exp: "doc", "doc.url contains '/step-by-step/'" -%} -{% for tutorial in tutorials %} - {% assign tutorial_url = tutorial | prepend:"/tutorials/" | append:"/" %} - {% if tutorial_url == page.url %} +{% for doc in docs -%} + {% if doc.url == page.url -%}
- {% if forloop.first %} - Back - {% else %} - {% assign previous = forloop.index0 | minus: 1 %} - {% assign previous_page = tutorials[previous] | prepend:"/tutorials/" | append:"/" %} - - {% endif %} + {% if forloop.first -%} + Back + {% else -%} + {% assign previous = forloop.index0 | minus: 1 -%} + + {% endif -%}
- {% if forloop.last %} - Next - {% else %} - {% assign next = forloop.index0 | plus: 1 %} - {% assign next_page = tutorials[next] | prepend:"/tutorials/" | append:"/" %} - - {% endif %} + {% if forloop.last -%} + Next + {% else -%} + {% assign next = forloop.index0 | plus: 1 -%} + + {% endif -%}
- {% break %} - {% endif %} -{% endfor %} - - -{% for doc in docs %} - {% if doc.url == page.url %} -
-
- {% if forloop.first %} - Back - {% else %} - {% assign previous = forloop.index0 | minus: 1 %} - - {% endif %} -
-
- {% if forloop.last %} - Next - {% else %} - {% assign next = forloop.index0 | plus: 1 %} - - {% endif %} -
-
-
- {% break %} - {% endif %} -{% endfor %} + {% break -%} + {% endif -%} +{% endfor -%}
    - {% for step in docs %} -
  1. - - {{ step.title }} - -
  2. - {% endfor %} + {% for step in docs -%} +
  3. + {{- step.title -}} +
  4. + {% endfor -%}
diff --git a/docs/_includes/tutorials_contents.html b/docs/_includes/tutorials_contents.html index 5c9cdc8e..75fe9fc5 100644 --- a/docs/_includes/tutorials_contents.html +++ b/docs/_includes/tutorials_contents.html @@ -1,10 +1,16 @@
diff --git a/docs/_includes/tutorials_contents_mobile.html b/docs/_includes/tutorials_contents_mobile.html index 901fdf5c..217bc326 100644 --- a/docs/_includes/tutorials_contents_mobile.html +++ b/docs/_includes/tutorials_contents_mobile.html @@ -1,10 +1,14 @@
diff --git a/docs/_includes/tutorials_option.html b/docs/_includes/tutorials_option.html deleted file mode 100644 index 482c2143..00000000 --- a/docs/_includes/tutorials_option.html +++ /dev/null @@ -1,5 +0,0 @@ -{% for item in include.items %} - {% assign item_url = item | prepend:"/tutorials/" | append:"/" %} - {% assign tutorial = site.tutorials | where: "url", item_url | first %} - -{% endfor %} diff --git a/docs/_includes/tutorials_ul.html b/docs/_includes/tutorials_ul.html deleted file mode 100644 index a2b61326..00000000 --- a/docs/_includes/tutorials_ul.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 8e9574ad..9234c13c 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -1,13 +1,13 @@ -{% include top.html %} +{%- include top.html -%} - {% include header.html %} + {%- include header.html -%} - {{ content }} + {{- content -}} - {% include footer.html %} - {% include anchor_links.html %} - {% include analytics.html %} - {% include search/script.html %} + {%- include footer.html -%} + {%- include anchor_links.html -%} + {%- include analytics.html -%} + {%- include search/script.html -%} diff --git a/docs/_layouts/docs.html b/docs/_layouts/docs.html index ab179e50..f52e7831 100644 --- a/docs/_layouts/docs.html +++ b/docs/_layouts/docs.html @@ -2,24 +2,20 @@ layout: default --- -
-
- - {% include docs_contents_mobile.html %} - -
- -
- - {% include docs_contents.html %} - -
- +
+
+ {% include docs_contents_mobile.html -%} +
+
-
+ {% include docs_contents.html -%} +
+
+
diff --git a/docs/_layouts/news.html b/docs/_layouts/news.html index 8f7945f3..7b776bc7 100644 --- a/docs/_layouts/news.html +++ b/docs/_layouts/news.html @@ -2,18 +2,13 @@ layout: default --- -
-
- - {% include news_contents_mobile.html %} - -
- {{ content }} -
- - {% include news_contents.html %} - -
- +
+
+ {% include news_contents_mobile.html -%} +
+ {{- content -}}
-
+ {% include news_contents.html -%} +
+
+
diff --git a/docs/_layouts/news_item.html b/docs/_layouts/news_item.html index e9fa2aec..74d5d91b 100644 --- a/docs/_layouts/news_item.html +++ b/docs/_layouts/news_item.html @@ -12,17 +12,17 @@ layout: news
diff --git a/docs/_layouts/page.html b/docs/_layouts/page.html index bae31bb3..28364e7d 100644 --- a/docs/_layouts/page.html +++ b/docs/_layouts/page.html @@ -4,15 +4,12 @@ layout: default
-

{{ page.title }}

{{ content }}
-
-
diff --git a/docs/_layouts/step.html b/docs/_layouts/step.html index 7a3a593f..3bf1101c 100644 --- a/docs/_layouts/step.html +++ b/docs/_layouts/step.html @@ -1,26 +1,21 @@ --- layout: default --- -
-
- - {% include docs_contents_mobile.html %} - -
-
- -

Step by Step Tutorial

-

{{ page.position }}. {{ page.title }}

- {{ content }} - {% include step-index.html %} -
-
- - {% include docs_contents.html %} - -
- +
+
+ {% include docs_contents_mobile.html -%} +
+
+ +

Step by Step Tutorial

+

{{ page.position }}. {{ page.title }}

+ {{ content }} + {% include step-index.html -%} +
-
+ {% include docs_contents.html -%} +
+
+
diff --git a/docs/_layouts/tutorials.html b/docs/_layouts/tutorials.html index 3850971c..26d1aed0 100644 --- a/docs/_layouts/tutorials.html +++ b/docs/_layouts/tutorials.html @@ -2,26 +2,21 @@ layout: default --- -
-
- - {% include tutorials_contents_mobile.html %} - -
-
- -

{{ page.title }}

- {{ content }} - {% include section_nav_tutorials.html %} -
-
- - {% include tutorials_contents.html %} - -
- +
+
+ {%- include tutorials_contents_mobile.html -%} +
+
+ +

{{ page.title }}

+ {{- content -}} + {%- include section_nav_tutorials.html -%} +
-
+ {%- include tutorials_contents.html -%} +
+
+
diff --git a/docs/pages/404.html b/docs/pages/404.html index 9edc873b..dc4d9735 100644 --- a/docs/pages/404.html +++ b/docs/pages/404.html @@ -18,18 +18,10 @@ sitemap: false

The resource you requested was not found. Here are some links to help you find your way:

diff --git a/docs/pages/news.html b/docs/pages/news.html index 94139fc0..b806b0e5 100644 --- a/docs/pages/news.html +++ b/docs/pages/news.html @@ -5,6 +5,6 @@ permalink: /news/ author: all --- -{% for post in site.posts %} - {% include news_item.html %} -{% endfor %} +{% for post in site.posts -%} + {% include news_item.html -%} +{% endfor -%} diff --git a/docs/pages/releases.html b/docs/pages/releases.html index 153d022c..9736fbd8 100644 --- a/docs/pages/releases.html +++ b/docs/pages/releases.html @@ -5,6 +5,6 @@ permalink: /news/releases/ author: all --- -{% for post in site.categories.release %} - {% include news_item.html %} -{% endfor %} +{% for post in site.categories.release -%} + {% include news_item.html -%} +{% endfor -%} diff --git a/docs/pages/showcase.html b/docs/pages/showcase.html index 58d52c0a..98cd8917 100644 --- a/docs/pages/showcase.html +++ b/docs/pages/showcase.html @@ -9,18 +9,18 @@ redirect_from:

Jekyll is used for all kinds of usecases. Here's some of our favorites: