Conversation
✅ Deploy Preview for hugo-hextra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I think your PR must reference the issue #801 instead of the discussion #799. The comments inside a PR description cannot automatically close a discussion, they can only close an issue or another PR. The title can also be improved: For consistency, I recommend using a local variable: diff --git i/layouts/_partials/components/codeblock.html w/layouts/_partials/components/codeblock.html
index 857b925..43afe2e 100644
--- i/layouts/_partials/components/codeblock.html
+++ w/layouts/_partials/components/codeblock.html
@@ -1,5 +1,6 @@
{{ $filename := .filename | default "" -}}
{{ $base_url := .base_url | default "" -}}
+{{ $full_url := .full_url | default "" -}}
{{ $lang := .lang | default "" }}
{{ $content := .content }}
{{ $options := .options | default (dict) }}
@@ -13,8 +14,8 @@
{{- $file_url := $filename -}} <!-- default to just filename -->
- {{- with .full_url -}}
- {{- $file_url = . -}}
+ {{- if $full_url -}}
+ {{- $file_url = $full_url -}}
{{- else if $base_url -}}
{{- $file_url = urls.JoinPath $base_url $filename -}}
{{- end -}} |
|
@wharris23 could you update the PR based on the above feedback? |
|
@imfing Yes, I apologize for the delay. I am working on the PR today and tomorrow. |
no worries take your time |
Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
|
@imfing I believe all the checks pass now. Please let me know if you think this is good or if I can improve it. |
|
I think you missed this remark: For consistency, I recommend using a local variable: diff --git i/layouts/_partials/components/codeblock.html w/layouts/_partials/components/codeblock.html
index 857b925..43afe2e 100644
--- i/layouts/_partials/components/codeblock.html
+++ w/layouts/_partials/components/codeblock.html
@@ -1,5 +1,6 @@
{{ $filename := .filename | default "" -}}
{{ $base_url := .base_url | default "" -}}
+{{ $full_url := .full_url | default "" -}}
{{ $lang := .lang | default "" }}
{{ $content := .content }}
{{ $options := .options | default (dict) }}
@@ -13,8 +14,8 @@
{{- $file_url := $filename -}} <!-- default to just filename -->
- {{- if .full_url -}}
- {{- $file_url = . -}}
+ {{- if $full_url -}}
+ {{- $file_url = $full_url -}}
{{- else if $base_url -}}
{{- $file_url = urls.JoinPath $base_url $filename -}}
{{- end -}} |
template comments instead of HTML comments Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
| {{- /* Default to just filename */ -}} | ||
| {{- $file_url := $filename -}} | ||
|
|
||
| {{- if .full_url -}} |
There was a problem hiding this comment.
full_url is ignored when $base_url is empty, please pay attention to line 9
Summary
This PR adds support for using a
full_urlwhen linking files in code blocks.Changes
full_urlis provided, it is used directly.base_url + filenameor justfilename.This keeps the old behavior while allowing more flexibility for cases where file URLs don’t follow the standard format.
Closes #801