Skip to content

Commit

Permalink
fix edit post link
Browse files Browse the repository at this point in the history
Signed-off-by: The Anh Nguyen <ntheanh201@gmail.com>
  • Loading branch information
ntheanh201 committed Oct 23, 2024
1 parent 2f86f7d commit be0da71
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions docs/layouts/partials/page-meta-links.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{{ if .Path }}
{{ $pathFormatted := replace .Path "\\" "/" }}
{{ $gh_repo := ($.Param "github_repo") }}
{{ $gh_subdir := ($.Param "github_subdir") }}
{{ $gh_project_repo := ($.Param "github_project_repo") }}
{{ $gh_branch := (default "master" ($.Param "github_branch")) }}
{{ if $gh_repo }}
<div class="td-page-meta ml-2 pb-1 pt-2 mb-0">
{{ $editURL := printf "%s/edit/%s/content/%s" $gh_repo $gh_branch $pathFormatted }}
{{ if and ($gh_subdir) (.Site.Language.Lang) }}
{{ $editURL = printf "%s/edit/%s/%s/content/%s/%s" $gh_repo $gh_branch $gh_subdir ($.Site.Language.Lang) $pathFormatted }}
{{ else if .Site.Language.Lang }}
{{ $editURL = printf "%s/edit/%s/content/%s/%s" $gh_repo $gh_branch ($.Site.Language.Lang) $pathFormatted }}
{{ else if $gh_subdir }}
{{ $editURL = printf "%s/edit/%s/%s/content/%s" $gh_repo $gh_branch $gh_subdir $pathFormatted }}
{{ $editURL := "" }}
{{ if .File }}
{{ if .File.LogicalName }}
{{ if eq .File.LogicalName "_index.md" }}
{{ $editURL = printf "%s/edit/%s/%s/content/%s/%s" $gh_repo $gh_branch $gh_subdir .Site.Language.Lang (path.Dir .File.Path) }}
{{ else }}
{{ $editURL = printf "%s/edit/%s/%s/content/%s/%s" $gh_repo $gh_branch $gh_subdir .Site.Language.Lang .File.Path }}
{{ end }}
{{ end }}
{{ end }}

{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (htmlEscape $.Title )}}
<a href="{{ $editURL }}" target="_blank" rel="noreferrer"><i class="fa fa-edit fa-fw"></i> {{ T "post_edit_this" }}</a>
<a href="{{ $issuesURL }}" target="_blank" rel="noreferrer"><i class="fab fa-github fa-fw"></i> {{ T "post_create_issue" }}</a>
Expand Down

0 comments on commit be0da71

Please sign in to comment.