Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » Plugin: ajw_technorati_tags

#31 2005-01-26 22:05:15

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: Plugin: ajw_technorati_tags

I didn’t realize Technorati would pick up on categories; I haven’t tagged anything, but my entries are showing up over there…


You cooin’ with my bird?

Offline

#32 2005-01-26 22:39:20

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Plugin: ajw_technorati_tags

> fncll wrote:

> How hard would it be to use the logic of the plugin but have it insert into the body of the post in the RSS stream after the body text?

I put together a quick hack to do this by modifying txp_article.php. Essentially, when a post is saved, I append the technorati tags to the end of the body_html field that goes to the database. But, I do it inside of html comments so that they’re not obtrusive.

Will technorati pick up tags enclosed in comments? This way, I can use compooter’s plugin to control the display of tags on the page, and the tags get encoded into the body of the post that goes into the RSS feed.

What do you think? (See this in action in the latest two entries on my site, which I re-saved in order to update the body_html.)

Last edited by schussat (2005-01-26 22:56:55)


-Alan

Offline

#33 2005-01-26 22:55:59

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Plugin: ajw_technorati_tags

As I understand it Technorati exclusively gets your tags from RSS/Atom, whether it’s in the body of your post or in feed-specific category tags, such as <code><category></code> or <code><dc:subject></code>. I could be wrong about that though; it’s just what I took from fncll above.

edit:

ah – I see that you’ve implemented it in both.

You know, I still think that the best solution is not to hack too much and to rely on something that will most likely be integrated into the Txp core. The RSS/Atom file edits are very unobtrusive (1 or 2 line additions in all cases) and will most likely become standard someday. That in combination w/ the plugin (in its current state) would work well too.

I’ve been really busy and haven’t had much time to brainstorm lately, but there may be an even better way to do all of this…?

Last edited by compooter (2005-01-26 23:10:17)

Offline

#34 2005-01-26 23:27:25

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Plugin: ajw_technorati_tags

> compooter wrote:

> ah – I see that you’ve implemented it in both.

Yep, but it’s all done with just two changes: Adding the same small set of lines in two places. The body_html field is the one that’s sent out in the feed, so that’s the only thing that needs to be changed.

> You know, I still think that the best solution is not to hack too much and to rely on something that will most likely be integrated into the Txp core. The RSS/Atom file edits are very unobtrusive (1 or 2 line additions in all cases) and will most likely become standard someday. That in combination w/ the plugin (in its current state) would work well too.

Yeah, I think that you’re mainly right, and I’m not eager to hack it about too much. I thought I’d give it a try, though, because using categories seems limiting; I like being able to add tags as the mood strikes and not be limited to two of them. I don’t see this as a long-term solution, but something that may work for the time-being.


-Alan

Offline

#35 2005-01-26 23:29:49

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Plugin: ajw_technorati_tags

Yeah, therein lies the rub. Txp’s 2 category limit. Arg.

Lemme get my brain revved up & see if there’s something else we can muster up. What’ll probably need to happen is just do what was mentioned before, which is to create category/dc:subject tags in the feed as per the values in your keywords or custom field. So it’d kinda just do what the plugin does, but hacked into rss.php & atom.php.

notice how i always seem to edit my posts? it’s an affliction.

Last edited by compooter (2005-01-26 23:33:53)

Offline

#36 2005-01-26 23:50:07

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Plugin: ajw_technorati_tags

Well, it looks like my temporary solution is a bust: Technorati doesn’t pay any attention to tags that are found within html comments. This is probably a sensible way of keeping out material that isn’t a “real” part of the page. So, that was a fun hour, but it won’t do much good — unless, of course, I take the comment tags out of the hack, therefore displaying the tags right in the post. There’s still some latitude here: They could be styled and such, but it’s far more limited and harder to change than if the display is controlled by a plugin.


-Alan

Offline

#37 2005-01-27 07:11:01

fncll
Member
From: Frozen North
Registered: 2004-02-25
Posts: 19
Website

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

#38 2005-01-28 20:11:30

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

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

#40 2005-02-17 02:45:29

fncll
Member
From: Frozen North
Registered: 2004-02-25
Posts: 19
Website

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

#43 2005-02-17 04:05:30

Baseline_Benny
Archived Plugin Author
From: Brisbane, Australia.
Registered: 2004-06-01
Posts: 15
Website

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

#45 2005-02-17 16:11:34

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

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.

&gt; Andrew:

&gt; 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

  1. Index
  2. » Archives
  3. » Plugin: ajw_technorati_tags

Board footer

Powered by FluxBB