<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Nikola (Posts about comments)</title><link>https://getnikola.com/</link><description></description><atom:link href="https://getnikola.com/categories/comments.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Sat, 02 Dec 2023 09:00:47 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Really Static Comments with Staticman</title><link>https://getnikola.com/blog/really-static-comments-with-staticman.html</link><dc:creator>Roberto Alsina</dc:creator><description>&lt;p&gt;Static sites have many advantages, we always say. But they also have at least one
large inherent disadvantage: they are not dynamic. Not being dynamic means that
forms that alter the content of the site itself are not possible without going
outside the static side of things.&lt;/p&gt;
&lt;p&gt;That's why for comments we all end up using something like &lt;a class="reference external" href="http://disqus.com"&gt;Disqus&lt;/a&gt;
or some other alternative service, or &lt;a class="reference external" href="http://posativ.org/isso"&gt;Isso&lt;/a&gt; if you
prefer the annoyance of self-hosting instead of the annoyance of having your data
be owned by someone else.&lt;/p&gt;
&lt;p&gt;So... how about a service that lets you do forms, but:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;You keep full control of your data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The service doesn't limit what you can do with the data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can use it for most things a form is used for?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's free!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That service is called &lt;a class="reference external" href="https://staticman.net"&gt;Staticman&lt;/a&gt; and it's &lt;strong&gt;awesome&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This is how it works:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;You put your site in GitHub (or soon, Gitlab!)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You do &lt;a class="reference external" href="https://github.com/ralsina/staticman-data/blob/master/staticman.yml"&gt;some configuration&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And Staticman will take the form's data, convert it to JSON, YAML, or whatever, and put
it back in your site's GitHub repo. You can choose whether it uses "moderation", and
do that via a pull request, or not, in which case it just commits directly.&lt;/p&gt;
&lt;p&gt;Nikola can then use those data files from its templates, like in &lt;a class="reference external" href="https://github.com/ralsina/staticman-data/blob/master/templates/post.tmpl"&gt;this example&lt;/a&gt; which displays a form to post comments, and a list of previous comments.&lt;/p&gt;
&lt;p&gt;Then, if you combine that with an autobuild system, like &lt;a class="reference external" href="https://getnikola.com/blog/automating-nikola-rebuilds-with-travis-ci.html"&gt;using Travis&lt;/a&gt; or &lt;a class="reference external" href="https://getnikola.com/blog/from-zero-to-nikola-in-one-minute-without-installing-anything.html"&gt;Netlify&lt;/a&gt; or &lt;a class="reference external" href="https://gitlab.com/pages/nikola"&gt;Gitlab&lt;/a&gt; that means a few seconds/minutes after the form is submitted, the data appears back in the site.&lt;/p&gt;
&lt;p&gt;So, what do we end up with? A site with comments, where you own all the data, and not even need to
use Javascript to display the comments!&lt;/p&gt;
&lt;p&gt;You can see it in action in this demo site: &lt;a class="reference external" href="http://staticman-demo.netlify.com/posts/sample-post-with-staticman-comments.html"&gt;staticman-demo.netlify.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TODO:&lt;/strong&gt; submit the form via Javascript instead, so it does it in the background instead of
dumping JSON results on you.&lt;/p&gt;
&lt;p&gt;Have fun, leave a comment :-)&lt;/p&gt;</description><category>comments</category><category>netlify</category><category>nikola</category><category>staticman</category><guid>https://getnikola.com/blog/really-static-comments-with-staticman.html</guid><pubDate>Wed, 31 Aug 2016 12:51:07 GMT</pubDate></item></channel></rss>