From dbd88b7395ede7a3912380e4cf49347f9e161796 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 6 Oct 2020 23:05:36 +0200 Subject: [PATCH] use jekyll configuration for edit urls The existing implementation was broken, and didn't override the URLs (due to leading, trailing slashes the paths were not matched). Instead of using the custom "not_edited_here.yaml", set the edit-url as front-matter variable through the _config.yml Signed-off-by: Sebastiaan van Stijn --- .github/PULL_REQUEST_TEMPLATE.md | 3 --- _config.yml | 40 +++++++++++++++++++++++++++++ _config_authoring.yml | 40 +++++++++++++++++++++++++++++ _data/not_edited_here.yaml | 44 -------------------------------- _includes/body.html | 5 ++++ _layouts/docs.html | 13 ---------- 6 files changed, 85 insertions(+), 60 deletions(-) delete mode 100644 _data/not_edited_here.yaml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4cd61800a0..ac6c38af74 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,9 +2,6 @@ for this project's contribution guidelines. Remove these comments as you go. - DO NOT edit files and directories listed in _data/not_edited_here.yaml. - These are maintained in upstream repos and changes here will be lost. - Help us merge your changes more quickly by adding details and setting metadata (such as labels, milestones, and reviewers) over at the right-hand side.--> diff --git a/_config.yml b/_config.yml index 25e6c0c0da..6141892468 100644 --- a/_config.yml +++ b/_config.yml @@ -47,6 +47,46 @@ defaults: toc_min: 2 toc_max: 3 tree: true + + # 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" + - 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, and include banner in stubs that # content has moved to mirantis - scope: diff --git a/_config_authoring.yml b/_config_authoring.yml index 0e6824972e..6c548907c7 100644 --- a/_config_authoring.yml +++ b/_config_authoring.yml @@ -45,6 +45,46 @@ defaults: toc_min: 2 toc_max: 3 tree: true + + # 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" + - 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, and include banner in stubs that # content has moved to mirantis - scope: diff --git a/_data/not_edited_here.yaml b/_data/not_edited_here.yaml deleted file mode 100644 index b564422a89..0000000000 --- a/_data/not_edited_here.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Files and directories here are not edited in the docker.github.io repo. -# Instead, they are edited in the appropriate upstream repo and pulled -# into this repo periodically, or they are automatically generated. The intent -# is that if you submit a PR with changes to these files or directories, a CI -# job will fail in the PR, indicating that it should not be merged. THIS IS NOT -# YET IMPLEMENTED!! The PR reviewer should make sure no files here are in the PR. - -# If you need to edit these files or directories, submit a PR in the repo and -# directory listed in "source" below. - -# Make sure directories have the trailing slash, keep the list alphabetical - -overrides: -- path: /engine/api/ - description: "ReDoc/Swagger API specs" - source: https://github.com/docker/docker/tree/master/docs/api - -- path: /engine/deprecated/ - description: Docker Engine deprecation reference - source: https://github.com/docker/cli/tree/master/docs/deprecated.md - -- path: /engine/extend/ - description: References for Docker Engine plugin system - source: https://github.com/docker/cli/tree/master/docs/extend/ - -- path: /engine/reference/ - description: Docker Engine CLI and API references - source: https://github.com/docker/cli/tree/master/docs/reference/ - -- path: /notary/reference/ - description: Reference docs for Docker Notary - source: https://github.com/theupdateframework/notary/tree/master/docs/reference/ - -- path: /registry/configuration/ - description: Reference docs for configuring Docker Registry - source: https://github.com/docker/distribution/tree/release/2.7/docs/configuration.md - -- path: /registry/spec/ - description: Docker Registry API references - source: https://github.com/docker/distribution/tree/release/2.7/docs/spec/ - -- path: /compliance/ - description: Docker compliance - source: https://github.com/mirantis/compliance/tree/master/docs/compliance diff --git a/_includes/body.html b/_includes/body.html index 6768d42211..707dab18e1 100644 --- a/_includes/body.html +++ b/_includes/body.html @@ -1,3 +1,8 @@ +{%- 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 %} diff --git a/_layouts/docs.html b/_layouts/docs.html index 23bcc85532..d46e6f6995 100755 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -1,17 +1,4 @@ - {% include head.html %}