-
-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨Adds additional option for 'edit this page' feature #496
Conversation
* replaces possible backslash for win environments like in hugo docs explained: `.File.Path` returns paths joined by backslashes instead of slashes. * Updating the README! * Updating the README! * Updating the README! * Updating the README! * Updating the README! * Updating the README! * Updating the README! * Updating the README! * Updating the README! * Updating the README! * Updating the README! * fix mixture of permanent and relative links * Updating the README! * Updating the README! * Replace highlightBlock with highlightElement * Updating the README! * Updating the README! * deps: bump versions to latest * Updating the README! * Updating the README! Co-authored-by: Henk Verlinde <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mike Pianka <[email protected]> Co-authored-by: umatare5 <[email protected]> Co-authored-by: Henk Verlinde <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add GitLab as an option? And (to make it DRY), add a variable $editPath
(for instance), which can contain values /blob/
(Github), /_edit/
(Gitea), or /-/blob/
(GitLab). So, you'll have something like (not tested):
{{ $contentPath := "null"}}
{{ $editPath := "null"}}
{{ if (eq .Site.Params.repoHost "GitHub")}}
{{ $editPath := "/blob/"}}
{{ else if (eq .Site.Params.repoHost "Gitea")}}
{{ $editPath := "/_edit/"}}
{{ else if (eq .Site.Params.repoHost "GitLab")}}
{{ $editPath := "/-/blob/"}}
{{ end }}
{{ $contentPath = print .Site.Params.docsRepo $editPath .Site.Params.docsRepoBranch "/content/" }}
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested changes done 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good — thanks!
✨Adds additional option for 'edit this page' feature
📦 Content
repoHost
with allowed values:GitHub
Gitea
GitLab
edit-page.html
partial$contentPath
to avoid variable scoping issues.repoHost
value.🔖 Refs