I was wondering why CMS uses full URLs in internal links (internal to CMS) on published pages. Isn't there a way to make CMS use relative links in the published pages? Relative links are more useful for search engine optimization purposes.
Regards,
Sarmad
Re: Intra-CMS Links
Posted on Aug 21, 2007, by Morgan Burke
Sarmad,
This turns out to be a very tricky problem. Pages can have both static and dynamic representations, and dynamic pages can also be prepublished as static pages, and post-processed to insert dynamic content.
A particular page can be accessible in all of these modes at once. For instance, a static page could regenerate itself due to a recursive link in a plug-in, resulting in a dynamic page, but this dynamic page could be built from a prepublished static version of the page.
The URL path to the page differs in each case. For instance, each of these URLs might point to the same page:
Other cases may also be possible in a mod_rewrite scenario. Since the path varies in each case, using a relative URL might inadvertently invoke the target page in the wrong mode. For example, if the current URL is of the 3rd form, then a relative link to "foo.html" will go to
/cgi/foo.html
which is clearly wrong. So in that case we *must* use complete paths to ensure we can switch context between the HTdocs and CGI folders correctly.
As a general rule, it is easier to use complete paths everywhere than to figure out both the current mode and the target mode, and based on that info take a guess how relative the link can be. Because of mod_rewrite, it can Xonly ever be a guess, since some of the URL handling is outside our scope.
Re: Intra-CMS Links
Posted on Aug 21, 2007, by Morgan Burke
More thoughts...
Particular applications will know more about their local URL rules than the general-purpose system can assume. Therefore it should be possible for a local installation of ExSite to override the default URL construction rules, and substitute its own methods instead.
This is easy to allow for - we can just allow a handler for ExSite::Page::get_url(). Then a local site can optionally install its own page URL logic. I've added this. It doesn't go as far as solving your problem, but it at least allows for your problem to be solved in particular cases.
Re: Intra-CMS Links
Posted on Sep 24, 2007, by Morgan Burke
For ExSite 3.5.2, there will be some extra configuration settings to control relative and full URLs on pages.
These can be altered to force different default behaviour.
Note that in this case "relative" Xonly means that the hostname is excluded from the URL; the full path from the root is given. "http://mydomain.com/section/file.html" is an example of a full URL; "/section/file.html" would be the corresponding relative URL. The system does not yet support the completely relative "file.html", for reasons noted above.
Support > ExSite Webware Forum > Intra-CMS Links
Intra-CMS Links
Hello All,
This is my first post on this forum
I was wondering why CMS uses full URLs in internal links (internal to CMS) on published pages. Isn't there a way to make CMS use relative links in the published pages? Relative links are more useful for search engine optimization purposes.
Regards, Sarmad
Re: Intra-CMS Links
Sarmad,
This turns out to be a very tricky problem. Pages can have both static and dynamic representations, and dynamic pages can also be prepublished as static pages, and post-processed to insert dynamic content.
A particular page can be accessible in all of these modes at once. For instance, a static page could regenerate itself due to a recursive link in a plug-in, resulting in a dynamic page, but this dynamic page could be built from a prepublished static version of the page.
The URL path to the page differs in each case. For instance, each of these URLs might point to the same page:
/index.html /cgi/page.cgi/index.html /cgi/page.cgi?_id=1
Other cases may also be possible in a mod_rewrite scenario. Since the path varies in each case, using a relative URL might inadvertently invoke the target page in the wrong mode. For example, if the current URL is of the 3rd form, then a relative link to "foo.html" will go to
/cgi/foo.html
which is clearly wrong. So in that case we *must* use complete paths to ensure we can switch context between the HTdocs and CGI folders correctly.
As a general rule, it is easier to use complete paths everywhere than to figure out both the current mode and the target mode, and based on that info take a guess how relative the link can be. Because of mod_rewrite, it can Xonly ever be a guess, since some of the URL handling is outside our scope.
Re: Intra-CMS Links
More thoughts...
Particular applications will know more about their local URL rules than the general-purpose system can assume. Therefore it should be possible for a local installation of ExSite to override the default URL construction rules, and substitute its own methods instead.
This is easy to allow for - we can just allow a handler for ExSite::Page::get_url(). Then a local site can optionally install its own page URL logic. I've added this. It doesn't go as far as solving your problem, but it at least allows for your problem to be solved in particular cases.
Re: Intra-CMS Links
For ExSite 3.5.2, there will be some extra configuration settings to control relative and full URLs on pages.
Defaults (to match v3.5.1 behaviour) are:
page.relative_static_url = 0 page.relative_dynamic_url = 1
These can be altered to force different default behaviour.
Note that in this case "relative" Xonly means that the hostname is excluded from the URL; the full path from the root is given. "http://mydomain.com/section/file.html" is an example of a full URL; "/section/file.html" would be the corresponding relative URL. The system does not yet support the completely relative "file.html", for reasons noted above.