diff --git a/Dockerfile b/Dockerfile index 4b9fb2bd99..ab80d3bd1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,14 +57,14 @@ COPY --from=upstream-resources /usr/src/app/md_source/. ./ RUN ./_scripts/update-api-toc.sh ARG JEKYLL_ENV RUN echo "Building docs for ${JEKYLL_ENV} environment" -RUN set -eux; \ +RUN set -eu; \ if [ "${JEKYLL_ENV}" = "production" ]; then \ - jekyll build -d ${TARGET} --config _config.yml,_config_production.yml; \ + jekyll build --profile -d ${TARGET} --config _config.yml,_config_production.yml; \ + sed -i 's#/#https://docs.docker.com/#' "${TARGET}/sitemap.xml"; \ else \ - jekyll build -d ${TARGET}; \ + jekyll build --profile -d ${TARGET}; \ fi; \ - find ${TARGET} -type f -name '*.html' | while read i; do sed -i 's#\(]* href="\)https://docs.docker.com/#\1/#g' "$i"; done; \ - sed -i 's#/#https://docs.docker.com/#' "${TARGET}/sitemap.xml"; + find ${TARGET} -type f -name '*.html' | while read i; do sed -i 's#\(]* href="\)https://docs.docker.com/#\1/#g' "$i"; done; # This stage only contains the generated files. It can be used to host the diff --git a/_config.yml b/_config.yml index 9e285d14aa..7fecfb4453 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,8 @@ +## +# Default configuration file +# +# This file overrides options set in _config.yml for production / deploy +## name: Docker Documentation markdown: kramdown kramdown: @@ -11,11 +16,10 @@ incremental: true permalink: pretty safe: false lsi: false -exclude: ["_samples", "_scripts", "404.html", "datacenter", "ee", "index.html"] +exclude: ["_samples", "_scripts", "404.html", "datacenter", "ee", "index.html", "js/metadata.json"] # Component versions -- address like site.docker_ce_version # You can't have - characters in these for non-YAML reasons - latest_engine_api_version: "1.40" docker_ce_version: "19.03" compose_version: "1.27.4" @@ -24,15 +28,34 @@ compose_file_v2: "2.4" machine_version: "0.16.0" distribution_version: "2.7" -collections: - samples: - output: true - +# List of plugins to enable for local development builds. Mostly the same as +# for production, but without the "jekyll-sitemap" plugin, which is not needed +# for previewing, and excluding saves some time to build plugins: - jekyll-redirect-from - jekyll-relative-links - - jekyll-sitemap +# Assets +# +# We specify the directory for Jekyll so we can use @imports. +# +# For local development, we build css with the "expanded" format to produce +# human-readable output for easier debugging. +sass: + sass_dir: _scss + style: expanded + +# Set default options / metadata for some paths. +# +# Setting options here prevents having to repeat the same option in front-matter +# on every page. Avoid using wildcards, such as "path: engine/api/v1.*", as +# limitations in Jekyll cause those to introduce a _severe_ impact on build-time, +# affecting generation of (e.g.) sitemap.xml and metadata.json, resulting in the +# total build to take 60 seconds longer to build (!). +# +# The list below is for "development" (local builds, and PR previews) builds only, +# and should be kept minimal to allow for fast builds. Other options should go +# into _config_production.yml, which is used for production deploys. defaults: - scope: path: "" @@ -42,78 +65,7 @@ defaults: toc_min: 2 toc_max: 3 - # Set the correct edit-URL for upstream resources. We usually don't create a direct - # edit link for these, and instead point to the directory that contains the file. - - scope: - path: engine/api/v1.* - values: - edit_url: "https://github.com/docker/docker/tree/master/docs/api" - - scope: - path: engine/deprecated - values: - edit_url: "https://github.com/docker/cli/tree/master/docs/" - - scope: - path: engine/extend - values: - edit_url: "https://github.com/docker/cli/tree/master/docs/extend" - - scope: - path: engine/reference - values: - edit_url: "https://github.com/docker/cli/tree/master/docs/reference" - scope: path: engine/reference/commandline values: - edit_url: "https://github.com/docker/cli/tree/master/docs/reference/commandline" skip_read_time: true - - scope: - path: glossary - values: - edit_url: "https://github.com/docker/docker.github.io/blob/master/_data/glossary.yaml" - - scope: - path: notary/reference - values: - edit_url: "https://github.com/theupdateframework/notary/tree/master/docs/reference" - - scope: - path: registry/configuration - values: - edit_url: "https://github.com/docker/distribution/tree/master/docs" - - scope: - path: registry/spec - values: - edit_url: "https://github.com/docker/distribution/tree/master/docs/spec" - - scope: - path: compliance - values: - edit_url: "https://github.com/mirantis/compliance/tree/master/docs/compliance" - - # Hide Enterprise content from sitemap. These directories still contains stubs - # that are needed to redirect old URLs - - scope: - path: "datacenter" - values: - sitemap: false - title: Docker Enterprise moved to Mirantis - - scope: - path: "desktop/enterprise" - values: - sitemap: false - - scope: - path: "ee" - values: - sitemap: false - title: Docker Enterprise moved to Mirantis - - scope: - path: "machine" - values: - sitemap: false - - scope: - path: "samples/library" - values: - sitemap: false - -# Assets -# -# We specify the directory for Jekyll so we can use @imports. -sass: - sass_dir: _scss - style: expanded diff --git a/_config_production.yml b/_config_production.yml index 9b95b00f82..71664640e0 100644 --- a/_config_production.yml +++ b/_config_production.yml @@ -1,11 +1,112 @@ +## +# This file overrides options set in _config.yml for production / deploy +## -# Include files that are excluded in "development" ("enterprise" stubs) for production +# Override the exclusion list to include files that are excluded in "development", +# such as the "enterprise" stubs, which are in place to facilitate redirects +# to Mirantis. exclude: ["_scripts", "404.html", "index.html"] # Google Analytics, etc. google_analytics: GTM-WL2QLG5 polldaddy_id: 8453675 +plugins: + - jekyll-redirect-from + - jekyll-relative-links + - jekyll-sitemap + # Assets +# +# For production/deploy, we build css with the "compressed" format, to produce +# smaller files. sass: style: compressed + +collections: + samples: + output: true + +# Set default options / metadata for some paths. +# +# Setting options here prevents having to repeat the same option in front-matter +# on every page. Avoid using wildcards, such as "path: engine/api/v1.*", as +# limitations in Jekyll cause those to introduce a _severe_ impact on build-time, +# affecting generation of (e.g.) sitemap.xml and metadata.json, resulting in the +# total build to take 60 seconds longer to build (!). +# +# The list below is used for *production* deploys, and overrides the one defined +# in "_config.yml", which is used for local builds and pull-request previews. +defaults: + - scope: + path: "" + type: "pages" + values: + layout: docs + toc_min: 2 + toc_max: 3 + + # Set the correct edit-URL for upstream resources. We usually don't create a direct + # edit link for these, and instead point to the directory that contains the file. + - scope: + path: engine/deprecated.md + values: + edit_url: "https://github.com/docker/cli/tree/master/docs/" + - scope: + path: engine/extend.md + values: + edit_url: "https://github.com/docker/cli/tree/master/docs/extend" + - scope: + path: engine/reference + values: + edit_url: "https://github.com/docker/cli/tree/master/docs/reference" + - scope: + path: engine/reference/commandline + values: + edit_url: "https://github.com/docker/cli/tree/master/docs/reference/commandline" + skip_read_time: true + - scope: + path: glossary.md + values: + edit_url: "https://github.com/docker/docker.github.io/blob/master/_data/glossary.yaml" + - scope: + path: notary/reference + values: + edit_url: "https://github.com/theupdateframework/notary/tree/master/docs/reference" + - scope: + path: registry/configuration + values: + edit_url: "https://github.com/docker/distribution/tree/master/docs" + - scope: + path: registry/spec + values: + edit_url: "https://github.com/docker/distribution/tree/master/docs/spec" + - scope: + path: compliance + values: + edit_url: "https://github.com/mirantis/compliance/tree/master/docs/compliance" + + # Hide Enterprise content from sitemap. These directories still contains stubs + # that are needed to redirect old URLs + - scope: + path: "datacenter" + values: + sitemap: false + title: Docker Enterprise moved to Mirantis + - scope: + path: "desktop/enterprise" + values: + sitemap: false + - scope: + path: "ee" + values: + sitemap: false + title: Docker Enterprise moved to Mirantis + - scope: + path: "machine" + values: + sitemap: false + - scope: + path: "samples/library" + values: + sitemap: false diff --git a/_includes/body.html b/_includes/body.html deleted file mode 100644 index db8f03ec6e..0000000000 --- a/_includes/body.html +++ /dev/null @@ -1,77 +0,0 @@ -{%- if page.edit_url -%} - {%- assign edit_url = page.edit_url -%} -{%- else -%} - {%- assign edit_url = "https://github.com/docker/docker.github.io/edit/master/" | append: page.path -%} -{%- endif -%} - -
- {% include header.html %} -
-
-
-
-
-
-
- {%- if page.title -%} -

{{ page.title }}

- {%- endif -%} - {%- if page.advisory -%} -
{{ site.data.advisories.texts[page.advisory] | markdownify }}
- {%- endif -%} - {%- unless page.skip_read_time == true -%}{% include read_time.html %}{%- endunless -%} - {{ content }} - {%- unless page.notags == true -%} - {%- assign keywords = page.keywords | split:"," -%} - {%- if keywords.size > 0 -%} - - {%- for keyword in keywords -%} - {%- assign strippedKeyword = keyword | strip -%} - {{ strippedKeyword }} - {%- unless forloop.last %}, {% endunless -%} - {%- endfor -%} - - {%- endif -%} - {%- endunless %} - {%- if site.polldaddy_id and page.noratings != true -%} -
- {%- endif -%} -
-
- -
- -
-
-
-
-
-
- {% include footer.html %} -
- - {%- if jekyll.environment == 'production' -%}{%- include analytics/polldaddy.html -%}{%- endif -%} - diff --git a/_includes/side-menu.html b/_includes/side-menu.html deleted file mode 100644 index bd78ba6a7c..0000000000 --- a/_includes/side-menu.html +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/_layouts/docs.html b/_layouts/docs.html old mode 100755 new mode 100644 index f68f39ecca..9ebb80d267 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -1,10 +1,90 @@ - + {%- include head.html -%} -{%- if page.landing == true -%} - {%- include body-landing.html -%} -{%- else -%} - {%- include body.html -%} -{%- endif -%} + +
+ {% include header.html %} +
+
+
+
+
+
+
+ {%- if page.title -%} +

{{ page.title }}

+ {%- endif -%} + {%- if page.advisory -%} +
{{ site.data.advisories.texts[page.advisory] | markdownify }}
+ {%- endif -%} + {%- unless page.skip_read_time == true -%} + {%- assign words = content | number_of_words -%} + {%- if words >= 360 -%} +

Estimated reading time: {{ words | divided_by:180 }} minutes

+ {%- endif -%} + {%- endunless -%} + {{ content }} + {%- unless page.notags == true -%} + {%- assign keywords = page.keywords | split:"," -%} + {%- if keywords.size > 0 -%} + + {%- for keyword in keywords -%} + {%- assign strippedKeyword = keyword | strip -%} + {{ strippedKeyword }} + {%- unless forloop.last %}, {% endunless -%} + {%- endfor -%} + + {%- endif -%} + {%- endunless %} + {%- if site.polldaddy_id and page.noratings != true -%} +
+ {%- endif -%} +
+
+ +
+ +
+
+
+
+
+
+ {% include footer.html %} +
+ + {%- if jekyll.environment == 'production' -%}{%- include analytics/polldaddy.html -%}{%- endif -%} + diff --git a/_includes/body-landing.html b/_layouts/landing.html similarity index 100% rename from _includes/body-landing.html rename to _layouts/landing.html diff --git a/index.md b/index.md index b788109b2d..3ec9ccfc8d 100644 --- a/index.md +++ b/index.md @@ -1,7 +1,7 @@ --- description: Home page for Docker's documentation keywords: Docker, documentation, manual, guide, reference, api, samples -landing: true +layout: landing title: Docker Documentation notoc: true notags: true