Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to link to site.com/cat/ instead of cat/index.html?

Quote Reply
How to link to site.com/cat/ instead of cat/index.html?
I've searched the forum and cannot find the answer to this. What I want to do is have the program link to the root directories with no file.

Example:
domain.com/
domain.com/category1/
domain.com/category2/

Instead of what it does:
domain.com/index.html
domain.com/category1/index.html
domain.com/category2/index.html

Does anybody know if this is possible?
Quote Reply
Re: [MrSteve] How to link to site.com/cat/ instead of cat/index.html? In reply to
I see that this was also addressed in this thread with no solution:

http://www.gossamer-threads.com/...2Findex.html;#127529

Any ideas? Thanks.
Quote Reply
Re: [MrSteve] How to link to site.com/cat/ instead of cat/index.html? In reply to
You could define a global remove_build_index,
Code:
sub {
my $string = shift;
$string =~ s,$CFG->{build_index}",",g;
return $string;
}
The you would use the global on any template as <%remove_build_index($some_variable)%>. For example, on category.html, you could use <%remove_build_index($links)%>.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How to link to site.com/cat/ instead of cat/index.html? In reply to
-- I've edited my long message of code because I figured it out. --

I've added a "template global" named "remove_build_index" and have added the code you said above:

Code:
sub {
my $string = shift;
$string =~ s,$CFG->{build_index}",",g;
return $string;
}


Then I used it in home.html as a test: replacing <%category%> with
<%remove_build_index($category)%>
It has worked great! No more index.html, just linking directly to the directory! Later today I'll be doing that to all variables to remove the index file.

Thanks yogi!

Last edited by:

MrSteve: Jan 24, 2003, 7:27 AM
Quote Reply
Re: [MrSteve] How to link to site.com/cat/ instead of cat/index.html? In reply to
Replace

<%links%>

with

<%remove_build_index($links)%>

and similarly for <%category%>.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How to link to site.com/cat/ instead of cat/index.html? In reply to
Thanks!

I guess we were typing at the same time ;)
Quote Reply
Re: [MrSteve] How to link to site.com/cat/ instead of cat/index.html? In reply to
thanks folks! this post helped meSmile

Denis
------
Webmaster Key - Discussion Forums
Pharos Search - A Human Edited Directory