Welcome to Geeklog, Anonymous Wednesday, October 09 2024 @ 05:56 pm EDT

Geeklog Forums

Converting Site-Relative Links to Absolute Paths


Status: offline

masodo

Forum User
Chatty
Registered: 11/13/12
Posts: 35
Location:Indiana US
I have really enjoyed my Geeklog adventure thus far and thought I would share my latest success in running BlogDogIt.com (for the record I am running GL Version 1.8.1)

First let me say that I have set-up a WordPress site and a Blogger site so that I might participate with all those many bloggers utilizing those platforms. I use my pages from those services to advertise and link to my Geeklog site. Recently I created a Feedburner RSS Feed from my Geeklog feed so that I could utilize the animated Feedburner widget on those "other" blog pages. I have also added the Feedburner "Subscribe To My Site Via Email" Service link to my Geeklog page.

I was not too far into this endeavor before I noticed there was a problem with how my feed was rendering on both the Feedburner feed page and in the Updates sent to email subscribers. The problem was that for the most-part I use site-relative linking which means that all image source links and local page links were broken in the syndicated versions of the posts. Of course the fix for this is to replace all site-relative links with their absolute path counterparts.

So from now on I will be using full paths when I create my posts but as for all those previously published posts that use the site-relative links I decided to craft a MySQL statement to convert all the links in the gl_stories table to absolute paths in one "fell swoop."

Of course the very first thing I did was back-up my entire database. I then logged-in to phpmyadmin and exported my gl_stories table to a file so that even my back-up had a back-up.

The SQL statement that I ran against my Database was based on the following syntax:
Text Formatted Code
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');


In my case the specific commands were as follows:

Text Formatted Code
update gl_stories set introtext = replace(introtext,'="/','="http://BlogDogIt.com/');
 

and
Text Formatted Code

update gl_stories set bodytext = replace(bodytext,'="/','="http://BlogDogIt.com/');
 

And that - as they say - was that! Mission accomplished.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
So you'll have to run that query every time you create a new story? Personally I'd update the RSS feed generator to include full urls.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

masodo

Forum User
Chatty
Registered: 11/13/12
Posts: 35
Location:Indiana US
The plan is to always use full URLs in my posts from here on out. This maneuver was to get all previous entries up-to-speed. True, I should probably look into altering the RSS Generator to rewrite site relative paths to full paths. However, I found this to be an immediate fix, well within my comfort zone. If anyone has worked out the suggested RSS generator alteration I sure would be grateful to learn the details. Big Grin
 Quote

All times are EDT. The time is now 05:56 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content