Skip to content

Commit

Permalink
add backup url fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
HussainTaj-arbisoft committed Jan 23, 2024
1 parent a24163e commit 35b5f41
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base-theme/layouts/partials/external-link.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{ $text := default "" (.text | htmlEscape | .context.RenderString) }}
{{ $isImage := default false .isImage }}
{{ $href := default "" .href }}
{{ if .isDefunct }}
{{ $href = .backupHref }}
{{ end }}

{{ if $isImage }}
<img src="{{- $href -}}" alt="{{- $text -}}" />
Expand Down
2 changes: 2 additions & 0 deletions base-theme/layouts/shortcodes/link.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
(dict
"text" .Params.text
"href" .Params.external_url
"backupHref" .Params.backup_url
"isImage" .Params.is_image
"isDefunct" .Params.is_defunct
"context" .
)
}}
Expand Down
2 changes: 2 additions & 0 deletions course-v2/layouts/links/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
(dict
"text" .Params.text
"href" .Params.external_url
"backupHref" .Params.backup_url
"isImage" .Params.is_image
"isDefunct" .Params.is_defunct
"context" .
)
}}
Expand Down
3 changes: 3 additions & 0 deletions course-v2/layouts/partials/nav_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
(dict
"text" .menuItem.Name
"href" $linkedPage.Params.external_url
"backupHref" $linkedPage.Params.backup_url
"isImage" false
"isDefunct" $linkedPage.Params.is_defunct
"context" $linkedPage
"class" "text-dark nav-link"
)
Expand Down

0 comments on commit 35b5f41

Please sign in to comment.