URL Anchors

  • Author
    Posts
  • #8263

    I was wondering how I can use a URL anchor within my post. How would I self reference a page?

    For example in I had a long article, and at the top I had summary points, and from there the user can “jump to” that anchor. However, when a URL is generated on WP, there is no “actual” page, e.g. http://local.domain/2006/03/26/my-article/, where you can place a usual web anchor: http://local.domain/2006/03/26/my-article/THIS_PAGE.PHP#my_section. I tried putting a label after the usual URL: http://local.domain/2006/03/26/my-article/#my_section, but it did not work at all.

    Here’s the example code:
    ———————————–
    <a href="http://local.domain/2006/03/26/my-article/THIS_PAGE.PHP#my_section">My Section</a>

    text
    text
    text

    text

    <a name="my_section">My Section</a>

    text
    text

    ———————————–

    where THIS_PAGE.PHP refers to some page name I hope someone can tell me how to make this works or if there is some other solution, please share.

    Much thanks :)

    #8401

    ajaydsouza
    Member

    You can create the names as you do normally.

    If you want to link within the post then just use #my_section

    To link from another page, then use full url of post followed by #my_section

    e.g. http://local.domain/2006/03/26/my-article/#my_section

    #8440

    opps, I had a little snafu in my actual code, so thats why it didn’t work. LOL :P

    thanx :)

The topic ‘URL Anchors’ is closed to new replies.