Using the HashOver APIs

HashOver has a number of available APIs that you may find useful. As of writing this, there are four different APIs, two of which relate to summarizing the comments as either a comment count link or a list of the most recent comments from either a single page or across all pages, and the other two relate to retrieving the comments in either RSS or JSON format.

This API allows you to display the number of comments a page has as a link to that page.

This API is easy to use, only a few simple lines of code are needed, here's what you have to do...

  1. Place this JavaScript tag in either the <head> or <body> element of your website...

    <script type="text/javascript" src="/hashover/api/count-link.php"></script>
  2. Place any number of links like this anywhere on your website...

    <a class="hashover-count-link" href="https://example.com/super/cool/article.html"></a>

    Any link with the hashover-count-link class will have their content replaced with a comment count, or the text "Post Comment" if the page has no comments yet. If you want the count link to jump to the comments, place a #comments on the end of the URL.

Latest Comments API

This API allows you to display a configurable number of the most recent comments, either from a specific page or from every page.

This API is easy to use, its setup is similar to how you use HashOver itself...

  1. Place this JavaScript tag in either the <head> or <body> element of your website...

    <script type="text/javascript" src="/hashover/api/latest.php"></script>
  2. Place an element with the ID attribute hashover-latest on your website, this element is where the comments will appear. This element can be a simple <div> or <section> element, it just needs the correct ID attribute.

    Here is an example of a simple element that will work...

    <div id="hashover-latest"></div>

    Note: If an element like this does not exist on the page HashOver will try to find a nice place for the comments to appear. If the JavaScript tag is in the <body> element the comments will appear directly before the JavaScript tag, if the JavaScript tag is in the <head> element the comments will appear at the end of the <body> element.

  3. This step is optional, but required if you want to display the latest comments from a specific page.

    To display the latest comments from a specific page you need to change the JavaScript tag to this...

    <script type="text/javascript" src="/hashover/api/latest.php?auto=no"></script>

    And instantiate an instance of the HashOverLatest object with a specific URL or thread...

    <script type="text/javascript">
        var latest = new HashOverLatest ({
            url: 'https://example.com/super/cool/article.html'
        });
    </script>

    The HashOverLatest object is very similar to the HashOver object, they even share the same code. The HashOverLatest object accepts the following options url, thread, and website. See the Technical page for more information about these options.

RSS API

This API generates an RSS feed of comments from a specific page. This API is located at: /hashover/api/rss.php and accepts the following URL queries. The url query, which is required, controls which page to display comments from. The sorting query, which is optional, controls how the comments will be sorted, this query is by-date by default, see the Settings page for all available sorting options.

JSON API

This API generates JSON data of comments from a specific page. This API is located at: /hashover/api/json.php and accepts only one URL query, the url query, which is required to control which page to display comments from.