Adding ShareThis plugin to Advanced Typepad Templates

After looking for some answers and being very unsatisfied with the amount of information out there, I decided to share this.

What you need

1. You’ll need advanced template access in Typepad.
2. A Share This script for your registered blog.
3. Some HTML knowledge.

Basics

The Typepad foundation uses Moveable Type tags. You’ll see a tag called < MT Entries > that surrounds your posts. These tags are what list the posts on the page. There is an tag to close the post area. You’ll need to use these tags to place the ShareThis script in each post.

If you look in your Main Index Advanced Template, you will see a tag < $MTWeblogIncludeModule module=”entry-list-sticky”$ >. This is where your < MT Entries > ……. < /MT Entries > tag actually lives on the front page. In other pages (Individual, Date Archive, etc) we’ll be modifying a similar, but slightly different, entry list module. So it’s not going to be as obvious about where to place the script. We’ll need to do a teeny tiny hack to get it to display at each post.

The Hack

1. Log in to your Advanced Templates and choose your current design. Feel free to create a backup copy of your current design and mess with that one. This has saved me several (hundred) times.

2. Go to the Create New Template Module. Name it something helpful and obvious. We’ll be making two new modules, one for the main index page and one for the individual entry pages. I’m naming my main page module entry-list-addthis-main.

3. Open a new tab (or window) and copy the Featured Post code.

4. Paste your code in to the new entry-list-addthis-main module.

5. Copy your Addthis Script and place it just below the < p class=”entry-footer-info” > < $MTEntryPostFooter$ > Tag.

6. Publish your template.

7. Open your Main Index Template and look for the original < $MTWeblogIncludeModule module=”entry-list-sticky”$ > and replace it with < $MTInclude module=”entry-list-addthis-main”$ > (be sure to put the name of your main module if you chose a different name! And there shouldn’t be any spaced in the tags.)

8. Save and Publish your templates.

(As an aside…. Feel free to place < p > tags (no spaces) around the script if you want it on its own line like this..)

Individual Archive Pages

Only slightly different since we’ll be using the Individual Entries tag, you’ll create another module (I called mine entry-lists-individual. Such Genius.) Copy and Paste the code from the individual entries tag in to the template. Place your script in the same location (under the < div class=”entry-footer” > < MTIfNonEmpty tag=”MTEntryPostFooter” > < p class=”entry-footer-info” > tags) placing a < br / > between them if you’d prefer. (Click Save) Go back to your Individual Archive template and replace < $MTWeblogIncludeModule module=”entry-individual”$ > with < $MTInclude module=”entry-list-individual”$ >. (Click Save)

Publish your posts.

Viola!

(Special thanks to Asha for the module tips.)

(Created and originally posted on Mrs. Flinger)

Comments

  1. Hi Leslie,

    Thanks for the great post! Your readers may also benefit from our ShareThis API (STAPI). If you could inject the code you get in this procedure into the header you can, use the SHARETHIS.addEntry code to further customize your ShareThis button. See: http://support.sharethis.com/developers for more details. I’m happy to answer any questions anyone may have about the STAPI at feedback@sharethis.com.

    Thanks again!

  2. I could not get this to work for me! I got all the way to the…Open your Main Index Template and look for the original and replace it with
    I used the exact name as you as to not mess up- but when trying to publish this it brought up error.
    So I could not move forward.
    I want my share this back!!
    Thanks for getting this out there. Any suggestions? I did contact typepad- included your post- maybe they will use! 🙂

  3. When I make the new template module, it’s asking me to specify the output file. I put xml, but I think that’s wrong as it’s not working. Any ideas?

  4. Hey all!

    A couple of quick points to help everyone out.

    1. Make a template module for your Share This code. Call it “share-this” (shock!). Template modules are the ones at the bottom of the “Current Design” page. Copy in the code from Share This. Just use the “Share This for Other Websites” option within ShareThis.com for Publishers. Save and publish.

    2. I wouldn’t worry about putting the Share This code in the Main Index template (entry-list-sticky). The URL that will get passed to ShareThis will be the root URL of your blog, not the URL of the permalink for each post on the main page. IMHO only. Just put it on the Individual Archives template (entry-individual). Of course, if you want a ShareThis widget on the Main Index page, you can find someplace else to put it besides entry-list-sticky.

    3. Go grab the entry-individual code from the TypePad Knowledge Base, just like Leslie says. Instead of copying the ShareThis widget code into entry-individual, INCLUDE the share-this Module Template you made from point #1 above. You can use to do so.

    Now, if you need to change the Share This code and it’s in multiple places within your various templates, you only have to change the code within the “share-this” Module Template instead of going into each Index Template or Archive Template.

    Finally, one more thought – a great place to put code you want on EVERY page is in the sidebar (this is, if every page in your blog has a sidebar). So if you want “Share This” on the Main Index page as well as every Individual Archive page, About Me page, static Page pages, etc, just MTInclude the code in the sidebar.

    Hope this is helpful!

  5. Rats! WordPress stripped out my reference to . Remove the extra spaces.

    “You can use…” above does not make sense without the call to this MT directive.

  6. Nuts!

    Go look up the MTInclude tag in the TypePad Knowledge Base. It will tell you how to make pull in the “share-this” template module.

  7. Thanks for the tips Dave! I think the code you are talking about is this:

    < $MTWeblogIncludeModule module="module-name"$ >

    (Remove the spaces between the beginning and end brackets)

    You can find the info on TypePad Modules on this page

  8. For all you TypePad users out there who want to use a dynamic “Share This” widget that works on both entry-list modules and single entry modules, I wrote up a “how to” for Share This.

  9. I tried this, and the second part worked fine, in the Individual Archive Pages, but even though I followed this exactly on the Main Index Template- it’s not showing up. I’m not getting any error messages, just no icon.

    Stupid question: does it only show up when I post a new post? Or, should it apply to all the posts on my main page?

    I will be back if I figure out how to fix it:)

Leave a Reply