root-relative paths

654 views
Skip to first unread message

Gorc

unread,
Oct 13, 2011, 2:45:09 AM10/13/11
to bluegriffon
Hi,

I am a newbie in web developement and I enyjoy using bluegriffon
(win32) to start learning. But one thing bothers me a lot that may be
just related to my ignorance.

I tend to use root-relative paths in my HTML documents in some places
such as <link href="/css/menu_style.css"> or <(...) background="/
images/right_up_bg.gif">. While this works fine once placed on my HTML
server I can not make bluegriffon to find root-relative links while
editing. Is there any way to tell the bluegriffon which local folder
shall be taken as "root" of site? Or, is there any other tool, add-on
or similar animal to get such behavior while editing files with
bluegriffon?

Have a nice day,

gorc

Dominik Lenné

unread,
Jun 28, 2012, 7:15:57 AM6/28/12
to blueg...@googlegroups.com
Hi gorc,

in Your examples, You did not use root-relative paths but page-relative paths. This is very easily achieved in BG via the "URl relative to this page" check button in the "insert URL" dialog windows. This even works automatically for pages down in the hierarchy with constructions like "../css/". This holds for hyperlinks, background images and external css files linked to the document.

HTH

Dominik

arlomedia

unread,
Jun 28, 2012, 5:04:02 PM6/28/12
to blueg...@googlegroups.com
Both of the original poster's examples used root-relative, a.k.a. site-relative, paths, like "/images/logo.png." This is the approach I also use for my sites. Is there any support for this? Right now if I open an HTML file, all the images appear as empty gray boxes because the application can't resolve their paths.

Yu Tang

unread,
Jul 15, 2012, 1:55:31 PM7/15/12
to blueg...@googlegroups.com
How about base tag trick?

2012/6/29 6:04:02 UTC+9 arlomedia:

Dominik Lenné

unread,
Jul 16, 2012, 11:39:31 AM7/16/12
to blueg...@googlegroups.com
Hi,

correct me if I'm wrong, but AFAIK relative URLs relate normally to the current page. As I wrote above, this is no problem with BG.

Only if there is a <base....> tag, relative URLs relate to this base, I think.

The problem with the <base> tag is, that you have to change it, when you copy the page from the local installation to the remote installation.

Dominik

Yu Tang

unread,
Jul 16, 2012, 12:16:21 PM7/16/12
to blueg...@googlegroups.com
It might be best if BG supports root-relative feature.
But if doesn't, Base tag is the best alternative I can come up with.

If you want to push the page to remote with no change, maybe one-liner JS helps.

<head>
<script>if (location.protocol==='file:') document.writeln('<base href="yourRootURI">');</script>
...
</head>

I know, it's a bit ugly, hacky way and I didn't test it by myself. I just thought right now.
I hope it works.

2012/7/17 0:39:31 UTC+9 Dominik Lenné:

arlomedia

unread,
Jul 30, 2012, 1:28:30 PM7/30/12
to blueg...@googlegroups.com
Dominik, there are two kinds of relative paths. A file-relative path starts with .../ and as you said, this works fine in Blue Griffon. A site-relative or root-relative path starts with / and this is apparently not supported.

I use this second kind of path in all my website links, because the link can be the same no matter where it appears in the site structure and I don't have to update links if I rearrange the site structure. In other words, the links still work if I change a page URL from /contact/email.html to /support/contact/email.html.

In order to resolve a root-relative path, the application needs to know where the root directory of the site is. The web browser assumes it's the root of the domain name, but an HTML editor needs to know what directory on the local file system is the root of the site ... something like /users/arlo/projects/mywebsite. I think the simplest way to implement this in the app would be to let users add the root directories of all their sites to a list, and then whenever they open a file, the app would look for a matching parent directory and resolve links to that.

Let me know if you think you could add this. Otherwise I'm going to upgrade my copy of Dreamweaver and continue using that.

Dominik Lenné

unread,
Jul 31, 2012, 1:57:14 PM7/31/12
to blueg...@googlegroups.com
@arlomedia: Thank you for explaining this. This has been obviously out of my knowledge range until now.


Reply all
Reply to author
Forward
0 new messages