Skip to content

Commit

Permalink
post: add discussion board via giscus
Browse files Browse the repository at this point in the history
render: skip discussion board on static site
  • Loading branch information
RaphaelPour committed Mar 28, 2024
1 parent f3d5133 commit ad8e72c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# For next release
* **Raphael Pour**
* metadata: render posts with date instead of full timestamp
* post: add discussion board via github using giscus

*Not released yet*

Expand Down
17 changes: 17 additions & 0 deletions cmd/post.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,22 @@
<span class='date'>{{.CreatedAt}}</span>
{{ .Rendered }}
</div>
{{if .Discussion}}
<script src="https://giscus.app/client.js"
data-repo="RaphaelPour/blog-feedback"
data-repo-id="R_kgDOLmFm8g"
data-category="Announcements"
data-category-id="DIC_kwDOLmFm8s4CeQ5V"
data-mapping="og:title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="light"
data-lang="en"
crossorigin="anonymous"
async>
</script>
{{end}}
</body>
</html>
2 changes: 2 additions & 0 deletions cmd/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type Post struct {
CreatedAt string
Content string
FeaturedImage string
Discussion bool
Rendered template.HTML
Metadata *metadata.Metadata
}
Expand Down Expand Up @@ -169,6 +170,7 @@ var renderCmd = &cobra.Command{
Timestamp: meta.CreatedAt,
CreatedAt: meta.Date(),
Content: renderedStr,
Discussion: cfg.Discussion && !meta.Static,
Rendered: template.HTML(renderedStr),
FeaturedImage: featuredImage,
Metadata: meta,
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Config struct {
Description string `json:"description"`
ChillFiles []string `json:"chill-files"`
Footer string `json:"footer"`
Discussion bool `json:"discussion"`
}

func ConfigPath(postPath string) string {
Expand Down

0 comments on commit ad8e72c

Please sign in to comment.