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@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-10-06 23:05:36 +02:00
parent c3bcd2bc6c
commit dbd88b7395
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
6 changed files with 85 additions and 60 deletions

View File

@ -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.-->

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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 -%}
<body ng-app="Docker" ng-controller="DockerController" class="colums">
<header>
{% include header.html %}

View File

@ -1,17 +1,4 @@
<!-- Page generated {{ site.time }} -->
<!-- Logic for 'edit this button'
{% assign edit_url = "https://github.com/docker/docker.github.io/edit/master/" | append: page.path %}
{% for entry in site.data.not_edited_here.overrides %}
{% if page.path contains entry.path %}
{% if entry.source %}
{% assign edit_url = entry.source %}
{% else %}
{% assign edit_url = "" %}
{% endif %}
{% break %}
{% endif %}
{% endfor %}
-->
<!DOCTYPE html>
<html lang="en">
{% include head.html %}