|
| 1 | +{{- $repo := .Site.Params.github_repo | default "validatedpatterns/docs" -}} |
| 2 | +{{- $branch := .Site.Params.github_branch | default "main" -}} |
| 3 | +{{- $filePath := "" -}} |
| 4 | +{{- $rawUrl := "" -}} |
| 5 | +{{- $sourceLabel := "View source" -}} |
| 6 | +{{- if .File -}} |
| 7 | + {{- $filePath = .File.Path -}} |
| 8 | + {{- $rawUrl = printf "https://raw.githubusercontent.com/%s/%s/content/%s" $repo $branch $filePath -}} |
| 9 | + {{- if strings.HasSuffix $filePath ".md" -}} |
| 10 | + {{- $sourceLabel = "View as Markdown" -}} |
| 11 | + {{- end -}} |
| 12 | +{{- end -}} |
| 13 | + |
| 14 | +<div class="page-actions" data-permalink="{{ .Permalink }}"> |
| 15 | + <button type="button" class="page-actions__button" data-action="copy-page" aria-label="Copy page content"> |
| 16 | + <i class="far fa-copy" aria-hidden="true"></i> |
| 17 | + <span class="page-actions__label"><span class="page-actions__label-full">Copy page</span><span class="page-actions__label-short">Copy</span></span> |
| 18 | + </button> |
| 19 | + <button type="button" class="page-actions__toggle" aria-expanded="false" aria-label="More actions"> |
| 20 | + <i class="fas fa-chevron-down" aria-hidden="true"></i> |
| 21 | + </button> |
| 22 | + <ul class="page-actions__menu" role="menu"> |
| 23 | + <li role="menuitem"> |
| 24 | + <button type="button" data-action="copy-link"> |
| 25 | + <i class="fas fa-link" aria-hidden="true"></i> Copy link |
| 26 | + </button> |
| 27 | + </li> |
| 28 | + {{- if $rawUrl }} |
| 29 | + <li role="menuitem"> |
| 30 | + <a href="{{ $rawUrl }}" target="_blank" rel="noopener"> |
| 31 | + <i class="fab fa-markdown" aria-hidden="true"></i> {{ $sourceLabel }} |
| 32 | + </a> |
| 33 | + </li> |
| 34 | + {{- end }} |
| 35 | + <li class="page-actions__divider" role="separator"></li> |
| 36 | + <li role="menuitem"> |
| 37 | + <a href="https://claude.ai/new?q={{ printf "Read and summarize this documentation page: %s" .Permalink | urlquery }}" target="_blank" rel="noopener"> |
| 38 | + <i class="fas fa-robot" aria-hidden="true"></i> Open in Claude |
| 39 | + </a> |
| 40 | + </li> |
| 41 | + <li role="menuitem"> |
| 42 | + <a href="https://chatgpt.com/?q={{ printf "Read and summarize this documentation page: %s" .Permalink | urlquery }}" target="_blank" rel="noopener"> |
| 43 | + <i class="fas fa-comment-dots" aria-hidden="true"></i> Open in ChatGPT |
| 44 | + </a> |
| 45 | + </li> |
| 46 | + </ul> |
| 47 | +</div> |
0 commit comments