mirror of https://github.com/docker/docs.git
Merge pull request #18473 from dvdksn/data-front-matter
data front matter
This commit is contained in:
commit
f8ebcc6c9f
|
@ -0,0 +1,18 @@
|
|||
# this file lets you add descriptions and keywords
|
||||
# to files without modifying the file.
|
||||
#
|
||||
# Useful for upstream pages where we don't want to
|
||||
# or can't add front matter to the source!
|
||||
#
|
||||
# To add descriptions and keywords for a page,
|
||||
# add a key with the path of the page file,
|
||||
# relative to the content directory. For upstream
|
||||
# page files, that's the target of the file mount.
|
||||
|
||||
engine/reference/builder.md:
|
||||
description: |
|
||||
Find all the available commands you can use in a Dockerfile
|
||||
and learn how to use them, including COPY, ARG, ENTRYPOINT, and more.
|
||||
keywords: |
|
||||
dockerfile, docker file, docker copy, dockerfile exec, docker entrypoint,
|
||||
dockerfile entrypoint, dockerfile arg, docker args, entrypoint, shell dockerfile
|
|
@ -1,5 +1,5 @@
|
|||
{{ $title := partial "utils/title.html" . }}
|
||||
{{ $description := .Description | default .Summary }}
|
||||
{{ $description := partial "utils/description.html" . }}
|
||||
{{ if .IsHome }}
|
||||
<title>{{ site.Title }}</title>
|
||||
{{ else }}
|
||||
|
@ -13,7 +13,7 @@
|
|||
<meta name="description" content="{{ $description }}" />
|
||||
<meta
|
||||
name="keywords"
|
||||
content="{{ .Keywords | default "docker, docker open source, docker platform, distributed applications, microservices, containers, docker containers, docker software, docker virtualization" }}"
|
||||
content="{{- partial "utils/keywords.html" . -}}"
|
||||
/>
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{{ $desc := "" }}
|
||||
{{ if .Description }}
|
||||
{{ $desc = .Description }}
|
||||
{{ else }}
|
||||
{{ $desc = .Summary }}
|
||||
{{ with .File }}
|
||||
{{ with (index (site.Data.frontmatter) .Path) }}
|
||||
{{ with .description }}
|
||||
{{ $desc = strings.Replace . "\n" " " | strings.TrimRight " " }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return $desc }}
|
|
@ -0,0 +1,14 @@
|
|||
{{ $keywords := "" }}
|
||||
{{ if .Keywords }}
|
||||
{{ $keywords = .Keywords }}
|
||||
{{ else }}
|
||||
{{ $keywords = "docker, docker open source, docker platform, distributed applications, microservices, containers, docker containers, docker software, docker virtualization" }}
|
||||
{{ with .File }}
|
||||
{{ with (index (site.Data.frontmatter) .Path) }}
|
||||
{{ with .keywords }}
|
||||
{{ $keywords = strings.Replace . "\n" " " | strings.TrimRight " " }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return $keywords }}
|
|
@ -3,8 +3,13 @@
|
|||
{{ $title = .LinkTitle }}
|
||||
{{ else }}
|
||||
{{ $title = index (findRE `# .*` .RawContent) 0 | strings.TrimLeft "# " }}
|
||||
{{ if not $title }}
|
||||
{{ with .File }}
|
||||
{{ with .File }}
|
||||
{{ with (index (site.Data.frontmatter) .Path) }}
|
||||
{{ with .title }}
|
||||
{{ $title = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if not $title }}
|
||||
{{ $title = strings.ReplaceRE "[-_]" " " .TranslationBaseName }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue