Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other How should I address my internal links?

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #31134
    hoolyon
    Member

    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!

    #67699
    TT_Mark
    Member

    Try ‘/directory/page.html’. Basically says “Start from the site root, find the directory folder and then page.html”

    #67701
    hoolyon
    Member

    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.

    #67702
    Bob
    Member

    So whats wrong with using ../directory2/page.html then?

    #67703
    TT_Mark
    Member

    @hoolyon

    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 wrong

    #67704
    hoolyon
    Member

    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.

    #67708
    TT_Mark
    Member

    So what does the link look like if you use what I suggested above?

    #67709
    hoolyon
    Member

    No I tried it but it doesn’t find the directory.

    http://unitednationsfc.com/staging/
    and
    http://unitednationsfc.com/staging/schedule

    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 versa

    #67710
    hoolyon
    Member

    and it won’t work for either of them when its /images/logo.png

    #67711
    TT_Mark
    Member

    So you’re not actually only one directory down from the site root, which is why no one could help you.

    Try

    /staging/images/logo.png

    #66153
    hoolyon
    Member

    Solved, Thanks!

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Other’ is closed to new topics and replies.