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

Enable custom Staticman endpoint #31

Merged
merged 6 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ disableLanguages = [""]
# prefer to use. See Staticman.yml for additional settings.
[params.staticman]
# Sets Statiman to be active
# https://github.com/apps/staticman-net
# 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
gitProvider = "github" # either "github" or "gitlab"
username = ""
repo = ""
branch = ""
Expand Down Expand Up @@ -215,7 +218,7 @@ disableLanguages = [""]
url = "/contact/"
identifier = "far fa-envelope"
weight = 6

[Languages.br]
languageCode = "br"
LanguageName = "Português"
Expand Down
6 changes: 3 additions & 3 deletions layouts/post/staticman.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<h2>Say something</h2>
{{ with .Site.Params.staticman }}
<form class="post-new-comment" method="POST" action="https://dev.staticman.net/v3/entry/github/{{ .username }}/{{ .repo }}/{{ .branch }}/data/comments">
<form class="post-new-comment" method="POST" action="https://{{ .api }}/v3/entry/{{ .gitprovider }}/{{ .username }}/{{ .repo }}/{{ .branch }}/comments">
{{ end }}
<input type="hidden" name="options[redirect]" value="{{ .Site.BaseURL }}{{ .RelPermalink }}">
<input type="hidden" name="options[entryId]" value="{{ .UniqueID }}">
<input type="hidden" name="options[entryId]" value="{{ .File.UniqueID }}">
VincentTam marked this conversation as resolved.
Show resolved Hide resolved
<input required name="fields[name]" type="text" placeholder="Your name (Required)">
<input name="fields[website]" type="text" placeholder="Your website">
<input required name="fields[email]" type="email" placeholder="Your email address (Required for Gravatar)">
Expand Down Expand Up @@ -31,7 +31,7 @@ <h2>Comments</h2>

{{ $comments := readDir "data/comments" }}
{{ $.Scratch.Add "hasComments" 0 }}
{{ $entryId := .UniqueID }}
{{ $entryId := .File.UniqueID }}

{{ range $comments }}
{{ if eq .Name $entryId }}
Expand Down