- This topic is empty.
January 2, 2011 at 4:19 pm #31134
I’m having a bit of a tough time on how to address my internal links. I usually just do the regular directory/page.html. But using includes it gets a bit annoying. If I use the ../directory/page.html, the code will work fine in every page that’s within a directory, but they obviously won’t work if the same include is included in my index page. To overcome this problem I just put down the entire address http://www.website.com/directory/page.html, but I was wondering if there is another way around it?
I hope I didn’t confuse anyone reading this. Thanks!January 2, 2011 at 5:09 pm #67699
Try ‘/directory/page.html’. Basically says “Start from the site root, find the directory folder and then page.html”January 2, 2011 at 5:51 pm #67701
Yes but /directory/page.html will only work when linked from my index page. If I’m in /directory2/page.html and I want to link to /directory/page.html I would either have to put ../directory/page.html or the entire address http://www.website.com/directory/page.html
If I were to just put /directory/page.html within /directory2/page.html it would like for “directory” within “directory2” which doesn’t exist.January 2, 2011 at 6:02 pm #67702BobMember
So whats wrong with using ../directory2/page.html then?January 2, 2011 at 6:28 pm #67703
Did you actually try what I suggested or just instantly dismiss it? ‘directory/page.html’ will only work from the index page, whereas ‘/directory/page.html’ will work from anywhere, because you are specifically saying “look for this page starting from the site root, regardless of the current directory I am linking from.”
Please try what is suggested before saying the advice is wrongJanuary 2, 2011 at 6:31 pm #67704
That it’s going to be used in an include, and that include is going to be used in my index page. The ../directory2/page.html won’t work on my index page. I wanted to know if there was some where around this where I won’t have to create a different include for the index or write the entire url. I’m sure there has to be because I see the ../directory/page.html being use every where and having a second include file is not very convenient.January 2, 2011 at 6:40 pm #67708
So what does the link look like if you use what I suggested above?January 2, 2011 at 6:42 pm #67709
No I tried it but it doesn’t find the directory.
Take the /images/logo.png for example. It will only show the logo when in /staging/ when its images/logo.png and in /staging/schedule/ when its ../images/logo.png
Not vice versaJanuary 2, 2011 at 6:43 pm #67710
and it won’t work for either of them when its /images/logo.pngJanuary 2, 2011 at 6:46 pm #67711
So you’re not actually only one directory down from the site root, which is why no one could help you.
/staging/images/logo.pngJanuary 13, 2011 at 10:44 am #66153
- The forum ‘Other’ is closed to new topics and replies.