Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Plugin: ajw_technorati_tags
Categories are problematic because of the limit of two of them. That’s not particularly tag-like :) You are correct that tags in comments seem to be ignored…
It’s vexing because the solutions to make them less obtrusive in the text don’t really matter too much for most feedreaders. Right now I’m embedding them manually in the post text, so anything is better than that!
I also agree that hacking the rss code is not optimal— code hacking is never optimal. But it might take a long while before something official comes out— and as far as I know the RSS streams aren’t exposed in any way for manipulation.
And since I’m hacking around in there to try to exclude a category from my RSS feed anyway…
Last edited by fncll (2005-01-27 07:12:44)
Dammit Jim, I’m a poet, not a programmer…
Joined the TXP Obsessed 2/25/04: http://www.chrislott.org/
Offline
Re: Plugin: ajw_technorati_tags
Okay, I know we agreed that I wasn’t going to hack around anymore, but I couldn’t help it. Inserting a few lines into both rss.php and atom.php inserts the tags into the RSS feed where they’re nice and unobtrusive, and they get picked up by technorati this way. It’s essentially an automation of what Chris has been doing manually, with the added bonus that the tags don’t show up in the regular article body unless you want them to.
For now, and only temporarily, this seems to work just fine.
[ ps: is anybody seeing weird forum behavior? I’m getting an error when I try to edit. I deleted my initial post and re-posted this; sorry if that caused any confusion. ]
-Alan
Offline
#39 2005-02-14 20:23:03
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Plugin: ajw_technorati_tags
minor updates to v0.6 (still haven’t yet tackled a full-fledged rss/atom solution)
Offline
Re: Plugin: ajw_technorati_tags
Excellent. Now that (maybe it was always this way) Technorati is allowing the href in the tag to point anywhere I’m toying with the idea of dropping categories altogether and only using tags. Instead of pointing the tags to technorati, I’ll have them point to http://www.chrislott.org/tag/tagname (or something) and feed that into a little keyword search facility. So my blog can be organized with tags (which I like) and not have to point only to Technorati’s aggregation (though I may point there too… or give an option on the link to look for more on my site, on technorati, etc…
Update: Alan— have you posted your changes anywhere?
Last edited by fncll (2005-02-17 02:49:45)
Dammit Jim, I’m a poet, not a programmer…
Joined the TXP Obsessed 2/25/04: http://www.chrislott.org/
Offline
#41 2005-02-17 03:08:53
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Plugin: ajw_technorati_tags
so on that token, would it make sense to allow for optionally changing the url format? what do you envision?
Alan, what you’re describing is appending the tags to the end of the body html string yes?
Last edited by Andrew (2005-02-17 03:09:56)
Offline
#42 2005-02-17 03:52:26
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Plugin: ajw_technorati_tags
Ok, so i’ve update 0.7 so that you can specify your own urls (as long as your url ends in [tagname]). Is this helpful for anyone? Is anyone actually using this plugin? ;-)
NOTE – I changed the default delimiter in this version to follow what most tag-based systems use (SPACE)
Last edited by Andrew (2005-02-17 04:03:35)
Offline
Re: Plugin: ajw_technorati_tags
> Andrew wrote:
> Is anyone actually using this plugin? ;-)
Not yet. But i plan to shortly. Watching this thread with interest.
Ben.
Life is what you make it… if nothing changes, nothing changes.
Web hosting http://dynamicwebhosting.com.au/
Web dev & marketing http://wallishamilton.com/
Offline
#44 2005-02-17 08:01:42
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Plugin: ajw_technorati_tags
Ok kids, time for more hacks. This one is actually a little sexier, if I do say so myself. It’s sort of a hybrid between the plugin and other rss/atom.php hacks. What it’ll do is add category and dc:subject tags to your rss/atom feeds based on the same criteria that the plugin uses (the contents of the custom field or keywords field).
RSS category tags (rss.php)
Find this:
<blockquote> <pre> $item = tag(strip_tags($Title),‘title’).n. tag($Body,‘description’).n. tag($link,‘link’).n; $out[] = tag($item,‘item’);</pre> </blockquote>Edit to this:
<blockquote> <pre> $item = tag(strip_tags($Title),‘title’).n. tag($Body,‘description’).n. tag($link,‘link’).n; foreach((array)fetch_tags($ID) as $tag) { $item .= n.tag(htmlspecialchars($tag),‘category’); } $out[] = tag($item,‘item’);</pre> </blockquote>Atom category tags (atom.php)
Find this:
<blockquote> <pre> $e[‘link’] = ‘<link’.relalt.texthtml.’ href=”’.$elink.’” />’; $e[‘id’] = tag(‘tag:’.$siteurl.’,’.date(“Y-m-d”,$uPosted).’:’.$ID,‘id’); $e[‘subject’] = tag(htmlspecialchars($Category1),‘dc:subject’);</pre> </blockquote>Edit to this:
<blockquote> <pre> $e[‘link’] = ‘<link’.relalt.texthtml.’ href=”’.$elink.’” />’; $e[‘id’] = tag(‘tag:’.$siteurl.’,’.date(“Y-m-d”,$uPosted).’:’.$ID,‘id’); $e[‘subject’] = tag(htmlspecialchars($Category1),‘dc:subject’); foreach((array)fetch_tags($ID) as $tag) { $e[‘subject’] .= n.tag(htmlspecialchars($tag),‘dc:subject’); } // sorta kludgy but not terrible</pre> </blockquote>The sorcery
Add this function to the bottom of both rss.php & atom.php (or stick it wherever suits yer fancy)
<blockquote> <pre> // ——————————————————————————————- function fetch_tags($id) { $delim = ‘ ‘; // delimiter used to separate tagnames $field = 1; // custom field used; empty ‘’ if none $keywords = ($field) ? fetch(“custom_$field”, ‘textpattern’, ‘ID’, $id) : fetch(“Keywords”, ‘textpattern’, ‘ID’, $id); if (!empty($keywords)) { $keywords = explode($delim,$keywords); foreach ($keywords as $keyword) { $out[] = trim($keyword); } return $out; } return; }</pre> </blockquote>Last edited by Andrew (2005-02-17 08:05:01)
Offline
Re: Plugin: ajw_technorati_tags
> fncll wrote:
> Update: Alan— have you posted your changes anywhere?
I haven’t so far, but I’d be happy to. I have a long day of teaching and meetings today, and I’ll try to package up my changes this evening.
> Andrew:
> Alan, what you’re describing is appending the tags to the end of the body html string yes?
This is what I did originally, but found that it didn’t have any effects because Technorati only pays attention to the feed, so I moved the code to rss.php and atom.php. I think it’s probably about the same as the new hack that you posted. I’ll have a chance to take a closer look tonight. For what it’s worth, it seems to have worked great for the last couple of weeks of use.
-Alan
Offline
Re: Plugin: ajw_technorati_tags
I pulled up my code and compared it with Andrew’s and I think that functionally we’re doing the same thing, though his code is elegant and mine is … not. I thought I’d post my code for the sake of comparison, but every attempt I have ever made to post code here has gone awry. What’s the proper markup to post code?
-Alan
Offline
#47 2005-02-18 19:57:42
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Plugin: ajw_technorati_tags
<em>let’s see if this works… (describing in textile how I post code in textile sorta reminds me of Mcsweeney’s E-mail Addresses It Would Be Really Annoying to Give Out Over the Phone) </em>
the way i did that up there ^^ is sorta a hack from the [SPACE] bug/feature in textile. this is how i enter the code into the textarea:
NOTE – replace <code>[]</code> with <code>< ></code> and <code>[SPACE]</code> with an actual space (or spaces). The blockquote is optional, I just like it that way ;-)
<code>[blockquote]</code>
<code>[SPACE][pre]</code>
<code>[SPACE]echo “hello world”;</code>
<code>[SPACE][SPACE][SPACE][SPACE]echo “indented hello world”;</code>
<code>[SPACE][/pre]</code>
<code>[blockquote]</code>
Last edited by Andrew (2005-02-18 20:57:44)
Offline
Re: Plugin: ajw_technorati_tags
Yowza. Okay, here goes.
In atom.php, before the line <code>// encode and entify</code>, add this block:
<blockquote>
<pre>
$keywords = “”;
$keywords = $Keywords;
$tagout = “”;
if (!empty($keywords)) {
$keywords = explode(’ ‘,$keywords);
foreach ($keywords as $keyword) {
$keyword = trim($keyword);
$tagout = $tagout.”<a href=\“http://technorati.com/tag/”.$keyword.”\” rel=\“tag\”>”.$keyword.”</a> “;
}
$tagout = “<p>[ tags: “.$tagout.” ]</p>”;
$Body = $Body.$tagout;
}
</pre>
</blockquote>
In rss.php, before the line <code>$Body = htmlspecialchars($Body,ENT_NOQUOTES);</code>, add this block:
<blockquote>
<pre>
$keywords = “”;
$keywords = $Keywords;
$tagout = “”;
if (!empty($keywords)) {
$keywords = explode(’ ‘,$keywords);
foreach ($keywords as $keyword) {
$keyword = trim($keyword);
$tagout = $tagout.”<a href=\“http://technorati.com/tag/”.$keyword.”\” rel=\“tag\”>”.$keyword.”</a> “;
}
$tagout = “<p>[ tags: “.$tagout.” ]</p>”;
$Body = $Body.$tagout;
}
</pre>
</blockquote>
All of this is basically just moving the plugin code, and in my case I hardcoded a space as the delimiter (in the $keywords=explode... line). For all I know, the way this puts tags into the feed violates all sorts of treaty obligations, but I based it on the existing look of the feed and wrapped the tags in a paragraph. And it seems to work, too.
Edit: With some minor formatting tweaking, that seems to have worked. Thanks, Andrew (and I loved the McSweeny’s bit)!
Last edited by schussat (2005-02-18 20:57:14)
-Alan
Offline