tlienart / Franklin.jl

(yet another) static site generator. Simple, customisable, fast, maths with KaTeX, code evaluation, optional pre-rendering, in Julia.
https://franklinjl.org
MIT License
951 stars 113 forks source link

Adding Comments to Your Franklin Blog with utteranc.es! #955

Open TheCedarPrince opened 2 years ago

TheCedarPrince commented 2 years ago

Hi all!

With help from @vchuravy and @tlienart , I learned how to add comments to a Franklin Blog using utteranc.es!

  1. Follow the guide provided here: https://utteranc.es
  2. (From @vchuravy's blog) Add the following function to your command but replace the HTML string with the HTML string provided by step 1:
"""
    {{ addcomments }}

Add a comment widget, managed by utterances <https://utteranc.es>.
"""
function hfun_addcomments()

    html_string = """
    <script src="https://utteranc.es/client.js"
           repo="TheCedarPrince/thecedarprince.github.io"
           issue-term="url"
           label="post"
           theme="github-light"
           crossorigin="anonymous"
           async>
    </script>"""

    return html_string
end
  1. On any blog page on your Franklin website, you can now write something like the following :
@def title = "Lord of the Flies"
@def slug = "04112022004224-lord-of-flies"
@def tags = ["summary", "book", "survival", "social", "critique"]

{{insert_note _assets/notes/04112022004224-lord-of-flies.md _assets/notes/zettel.bib}}

## Discussion:

{{addcomments}}

Now, enjoy your comments! Depending on how you configured your utteranc.es instance, the comments on your blog post will be mirrored to your repo! Here is an example:

Page:

image

And associated github issue automatically opened by utteranc.es:

image

Hope this helps all! :smile:

tlienart commented 2 years ago

and https://franklinjl.org/extras/utterances/ 😄