FastComments.com

Add Live Commenting to Tumblr Blogs

This guide adds the FastComments live commenting widget to the post pages of a Tumblr blog by editing the blog's custom theme HTML.

Tumblr does not provide a comment form on a blog's public pages. Visitors can comment on a post only from the Tumblr dashboard or the Tumblr mobile apps. The FastComments widget adds a comment area to each post's permalink page on the blog itself.

The code is added once to the theme and applies to existing and future posts. Each post gets its own comment thread, identified by the Tumblr post ID. Theme editing is only available on the Tumblr website.

This guide requires a FastComments account. You can create an account here.

Step 1: Enable the Custom Theme Internal Link

The theme HTML can only be edited when the blog's custom theme is enabled.

  1. On the Tumblr website, click Settings on the left.
  2. Select the blog on the right.
  3. Under Custom Theme, turn on the Enable custom theme switch.

Step 2: Open the Theme HTML Editor Internal Link

In the same blog settings, under Custom Theme, click Edit Theme. This opens the theme Customizer.

Click the Edit HTML button to open the source code editor.

Step 3: Add the FastComments Code to the Post Template Internal Link

In the theme HTML, find the closing {/block:Posts} tag. Tumblr renders everything between {block:Posts} and {/block:Posts} once for each post. Paste the following code directly before {/block:Posts}:

Tumblr FastComments Code
Copy Copy
1
2{block:PermalinkPage}
3<div id="fastcomments-widget"></div>
4<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
5<script>
6 window.FastCommentsUI(document.getElementById('fastcomments-widget'), {
7 tenantId: 'demo',
8 urlId: '{PostID}',
9 url: {JSPermalink}
10 });
11</script>
12{/block:PermalinkPage}
13

When you are logged in to FastComments, the snippet contains your tenant ID in place of demo. If it still shows tenantId: 'demo', log in and reload this page, or replace demo with your tenant ID.

To check the result, click Update Preview. When you are finished, click the back arrow, then click Save.

The code works as follows:

  • {block:PermalinkPage} renders its contents only on post permalink pages, so the widget is not added to pages that list several posts.
  • {PostID} is the numeric ID of the post and is used as the urlId. The comment thread stays attached to the post if its permalink changes.
  • {JSPermalink} outputs the post's permalink as a JavaScript string, including the quotes. It is stored as the link to the post in notifications and moderation tools.

To position the widget elsewhere on the permalink page, move the code to another location inside the {block:Posts} block.

Step 4: Show the Custom Theme on Mobile Internal Link

Tumblr can show a default mobile theme to mobile visitors in place of the custom theme. The default mobile theme does not include the FastComments code.

To show the custom theme, and the comment widget, on mobile devices:

  1. In the Customizer, scroll to Advanced Options at the bottom.
  2. Turn off Use default mobile theme.
  3. Click Save.

Tumblr Comments and Notes Internal Link

Tumblr comments are separate from FastComments comments. Tumblr users comment on a post from the dashboard or the mobile apps, and those comments appear in the post's notes together with likes and reblogs. Comments left in the FastComments widget do not appear in Tumblr notes, and Tumblr comments do not appear in the FastComments widget.

Tumblr does not provide a setting that turns comments off. The Comments setting, on the left side of the blog settings, limits who can comment. The most restrictive level allows comments only from blogs you follow.

A theme displays notes on permalink pages through the {PostNotes} variable, usually inside a {block:PostNotes} block. Removing that block from the theme HTML stops notes, including Tumblr comments, from being displayed on the blog. Notes remain visible on the Tumblr dashboard and in the apps.