Skip to content
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

Merged
merged 8 commits into from
Oct 8, 2021
Merged

✨Adds additional option for 'edit this page' feature #496

merged 8 commits into from
Oct 8, 2021

Conversation

OCram85
Copy link
Contributor

@OCram85 OCram85 commented Oct 8, 2021

📦 Content

  • adds addional param repoHost with allowed values:
    • GitHub
    • Gitea
    • GitLab
  • modified edit-page.html partial
    • had to set dummy value for $contentPath to avoid variable scoping issues.
    • Link text and href is now built depending on the repoHost value.

💡 @OCram85 noticed:
Tested with language mode enabled and set for usage with en

🔖 Refs

OCram85 and others added 6 commits April 19, 2021 19:19
* 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 <henk@henkverlinde.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mike Pianka <47948499+mikepianka@users.noreply.github.com>
Co-authored-by: umatare5 <umatare5@gmail.com>
Co-authored-by: Henk Verlinde <henk@ventizo.com>
Copy link
Member

@h-enk h-enk left a 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!

Copy link
Contributor Author

@OCram85 OCram85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested changes done 😄

@OCram85 OCram85 requested a review from h-enk October 8, 2021 09:19
Copy link
Member

@h-enk h-enk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good — thanks!

@h-enk h-enk merged commit b1227d7 into thuliteio:master Oct 8, 2021
adhadse pushed a commit to adhadse/doks that referenced this pull request Sep 17, 2022
✨Adds additional option for 'edit this page' feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants