Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
New site param to switch on/off Staticman
Browse files Browse the repository at this point in the history
Included backward compatibility for deprecated parameter
".site.Params.staticman.staticman".
  • Loading branch information
VincentTam committed Aug 15, 2019
1 parent a6aa2c3 commit b75aa75
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,12 @@ disableLanguages = [""]

# Disqus will take priority over Staticman (github.com/eduardoboucas/staticman)
# due to its ease of use. Feel free to check out both and decide which you would
# prefer to use. See Staticman.yml for additional settings.
# prefer to use. See staticman.yml for additional settings.
[params.staticman]
# Sets Statiman to be active
# If using GitHub, go to https://github.com/apps/staticman-net
# If using GitLab, just add the GitLab bot, NO need to hit `/connect/v3/...`
staticman = false
# Sets the location for Staticman to connect to
api = "dev.staticman.net" # without trailing slash
enabled = false
api = "" # without trailing slash, defaults to "api.staticman.net"
gitProvider = "github" # either "github" or "gitlab"
username = ""
repo = ""
Expand Down
4 changes: 3 additions & 1 deletion layouts/post/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<article class="post">
{{ template "_internal/disqus.html" . }}
</article>
{{ else if .Site.Params.staticman.staticman }}

{{/* Backwards compatibility for deprecated parameter ".Site.Params.staticman.staticman" */}}
{{ else if or .Site.Params.staticman.enabled .Site.Params.staticman.staticman }}
<article class="post">
{{ .Render "staticman" }}
</article>
Expand Down
2 changes: 1 addition & 1 deletion layouts/post/staticman.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2>Say something</h2>
{{ with .Site.Params.staticman }}
<form class="post-new-comment" method="POST" action="https://{{ .api }}/v3/entry/{{ .gitprovider }}/{{ .username }}/{{ .repo }}/{{ .branch }}/comments">
<form class="post-new-comment" method="POST" action="https://{{ .api | default "api.staticman.net" }}/v3/entry/{{ .gitprovider }}/{{ .username }}/{{ .repo }}/{{ .branch }}/comments">
{{ end }}
<input type="hidden" name="options[redirect]" value="{{ .Permalink }}">
<input type="hidden" name="options[entryId]" value="{{ .File.UniqueID }}">
Expand Down

0 comments on commit b75aa75

Please sign in to comment.