My readers don't understand how permalinks and anchor tags work
October 29, 2007 10:41 PM   Subscribe

Is there any way to automagically strip anchor tags from externally linked URLs?

I frequently use of Wordpress's "more" feature, meaning that many of my blog readers click "more" a post in its entirety.

Many of my readers aren't blog geeks, so when they want to link my posts, they just grab the anchor tagged url from their browser (say, and use that to link. This means that often when my posts are referenced on the web, readers click through and find themselves in the middle of the post.

I've tried dealing with this usual ways (posting announcements on my blog, making permalinks more prominent, adding "share this post" plugins, etc) but ultimately I'm fighting against the way my users read my site, which is "click more -- then grab the URL from their browser to link."

I also explored an .htaccess solution to see if it could strip anchor tags from external links, so that they'd point to instead of But anchor tags are a browser issue, not a server one.

I can't be the first blogger to have wrestled with this. Any advice other than ceasing to use the "more" feature?
posted by arielmeadow to Computers & Internet (8 answers total) 3 users marked this as a favorite
Can't you use "more", but have the "more" link point to the article page without the anchor? Users would have to scroll a bit, but assuming your teaser isn't too long this shouldn't be too much of a problem.
posted by neckro23 at 11:08 PM on October 29, 2007

If you understand you correctly, you want to replace the "more" link with the URL to the article page without the anchor tag as neckro23 suggests. Wordpress doesn't let you easily change this, I believe, but this plugin claims to do the trick.
posted by null terminated at 11:14 PM on October 29, 2007

Response by poster: I'd rather not punish all my readers for the linking mistakes of a few ... which changing the "more" link to just a standard permalink feels like it does.

The ideal would be a plugin that said, "If it's a link coming from outside, strip the anchor."
posted by arielmeadow at 11:40 PM on October 29, 2007

Are you sure the htaccess won't work? I'm not an expert, but it should be able to check for an anchor + not, then redirect to link sans anchor. If it has to be a WP plugin, that shouldn't be too difficult either...
posted by cdmwebs at 2:55 AM on October 30, 2007

Oops, never mind re: the htaccess solution. I see now that it's not available....
posted by cdmwebs at 2:59 AM on October 30, 2007

You can strip anchor tags with PHP.
posted by kirkaracha at 6:25 AM on October 30, 2007

Best answer: You could include a JavaScript that jumped to the top of the page when the Referer was not your site.
posted by oaf at 7:10 AM on October 30, 2007

Another possibility is to have your server check the HTTP referrer header. If it comes from your own site, then output the page as usual. If it comes from somewhere else, then the server just leaves out the anchor (<a name="more-474">), and so the browser doesn't find the requested anchor and stays at the top of the page. Feels hackish, but it should work.

I have no idea how you'd implement that with Wordpress in particular, though.
posted by Emanuel at 6:56 PM on October 30, 2007

« Older Okinawan Pop Band Halloween Costume Advice   |   Communicating with the Ex Newer »
This thread is closed to new comments.