May 17, 2004

Inline Trackbacks

In the default configurations for MT versions 2.661 and earlier, trackback links on your index and archive pages are set to generate a pop-up window containing the trackback information and pings. What if you would like to have the trackback pings appear on your individual entry pages, just as the comments do?

trackback_inline.gif

There are two straightforward methods for doing so. (Correction posted May 23, 2004) Both methods require that you rebuild your site in order for new trackback notices to appear on the individual entry pages. Method A method allows you to have trackback pop-ups as well as inline trackbacks. The second - Method B - involves a PHP include and requires that your site is in PHP and that you are doing only inline trackbacks, not pop-ups as well.

METHOD A:

1. Add trackback code to your Individual Entry Archive template.
Insert the following code on the template where you would like to have the trackback information:

<MTEntryIfAllowPings>
<a id="trackback"></a>Trackback
TrackBack URL for this entry:<br /><$MTEntryTrackbackLink$>

Here's what others have to say about <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a>:<br />

<MTPings>

<b> &raquo; <a name="<$MTPingID$>"></a><a href="<$MTPingURL$>" target="new"><$MTPingTitle$></a></b> from <$MTPingBlogName$><br />
<$MTPingExcerpt$>...<a href="<$MTPingURL$>" target="new">[read more]</a> <br />
Tracked: <$MTPingDate$>

</MTPings>
</MTEntryIfAllowPings>

Note that this code is missing all style tags.

The same code using MT3 style tags would look like this:

<MTEntryIfAllowPings>
<h2><a id="trackback"></a>Trackback</h2>
<p>TrackBack URL for this entry:<br /><$MTEntryTrackbackLink$></p>

<p>Here's what others have to say about <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a>:</p>

<MTPings>

<b> &raquo; <a name="<$MTPingID$>"></a><a href="<$MTPingURL$>" target="new"><$MTPingTitle$></a></b> from <$MTPingBlogName$><br />
<$MTPingExcerpt$>...<a href="<$MTPingURL$>" target="new">[read more]</a> <br />
<p class="posted">Tracked: <$MTPingDate$></p>

</MTPings>
</MTEntryIfAllowPings>

Here's the code using MT2.X style tags:

<MTEntryIfAllowPings>
<br />
<div class="comments-head"><a id="trackback"></a>Trackback</div><br />

<div class="comments-body">
TrackBack URL for this entry:<br /><$MTEntryTrackbackLink$><br /><br />

Here's what others have to say about <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a>:<br /><br />

<MTPings>

<b> &raquo; <a name="<$MTPingID$>"></a><a href="<$MTPingURL$>" target="new"><$MTPingTitle$></a></b> from <$MTPingBlogName$><br />
<$MTPingExcerpt$>...<a href="<$MTPingURL$>" target="new">[read more]</a> <br />
<span class="comments-post">Tracked: <$MTPingDate$></span><br /><br />

</MTPings>
</div>
</MTEntryIfAllowPings>

Save and rebuild.

2. Change the code in the Posted By sections to redirect link.
On your Main Index template, and any archive templates for which you want to have trackbacks listed in the Posted by line which follows each entry, replace

<a href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">TrackBack (<$MTEntryTrackbackCount$>)</a>

with

<a href="<$MTEntryPermalink$>#trackback">TrackBack (<$MTEntryTrackbackCount$>)</a>

Save and rebuild your templates.

METHOD B:
(Note: this tutorial requires PHP. See HTML or PHP for details if you are unsure about PHP.)

1. Open your Trackback Listing template. Delete all of the existing code from that template. (Make a back up if you want.) Copy all of the code that appears between the <MTEntryIfAllowPings> and </MTEntryIfAllowPings> tags in one of the code blocks above (pick the one with the appropriate style tags) and paste it into the Trackback Listing template.

2. Copy and paste the following PHP include into your Individual Entry Archive template.

<? include("<$MTCGIPath$>mt-tb.cgi?__mode=view&entry_id=<$MTEntryID$>"); ?>

This include should go between <MTEntryIfAllowPings> and </MTEntryIfAllowPings> tags in your Individual Entry Archive template where you would like the trackbacks to appear, for example, above the comments section.

3. Change the code in the Posted By sections to redirect link. As directed above in METHOD A.

Links:
What is Trackback?
Simple Comments - a plugin by Adam Kalsey that lets trackbacks show up interspersed with comments, as if they were comments.

Technorati Tags: MT2.661 Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://www.learningmovabletype.com/ . Thanks!

Posted by Elise Bauer on May 17, 2004 to Tutorials for Old Versions of MT
| Email to a friend | Printer-friendly version

Tagged: MT2.661

Related Entries


Trackback

If you would like to send a trackback
please use the following URL: http://www.learningmovabletype.com/cgi-bin/mt331/mt-tb.cgi/243

Email to a friend

Email this article to:


Your email address:


Message (optional):