Page edit and page view from GitLab not on every site

I found this code snippet Hugo v0.112.0 - New template functions from @jmooring. It works fine.

I do not need on every page the edit and view links. How can I have this links only on specific pages?

layouts/_default/single.html

{{ define "main" }}
<div class="container">
	<div class="row">
		<div class="col p-4 my-4">
			{{ .Content }}
			{{ $published := .PublishDate | time.Format ":date_medium" }}
			{{ $modified := .Lastmod | time.Format ":date_medium" }}
			{{ if ne $published $modified }}
			<span> Last modified: {{ $modified }} </span>
			{{ partial "repository-link.html" (dict "action" "edit" "page" .) }}
			{{ partial "repository-link.html" (dict "action" "view" "page" .) }}
			{{ end }}
		</div>
	</div>
</div>
{{ end }}

Wrap it in a conditional that checks for a front matter boolean, section name, whatever.

I do not need this links on the pages imprint, legal-notice and privacy-policy. Is it possible to deactivate the links in the frontmater of this pages?

Yes, just add some front matter to those pages, something like:

title = 'About'
[params]
disableGitHubEditLink = true

Then wrap the partial call with:

{{ if not .Params.disableGitHubEditLink }}

{{ end }}

I found my mistake.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.