Susan Williams
Susan Williams

Reputation: 317

how to create a permalink for my page?

I have created a FAQ page with more than 60 questions in it, Now i want to create a link to each question, so that i can provide the link in my blog and and on clicking the users can directly land on that question instead of having to go through the whole FAQ page. So how can I create the link? I am using only html, css and javascript. So can someone help me out with this?

Upvotes: 1

Views: 3371

Answers (4)

BrianPs
BrianPs

Reputation: 1

You have to create a folder named "your website topic/contents", and then you have to insert index.html in that folder, so you can set the link/url without showing .html extension on website. That's it from ke, i'm just beginner. Thank you.

Upvotes: 0

Maciej Kachniarz
Maciej Kachniarz

Reputation: 231

Add the script below to scroll smoothly

<a href="#question1">1. How to log out?</a><br/>

<h3 id="question1">1. How to log out?</h3>
<p>Answer...</p>

<script>
    $(function () {
        $('a[href*=#]:not([href=#])').click(function () {
            if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
                var target = $(this.hash);
                target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
                if (target.length) {
                    $('html,body').animate({
                        scrollTop: target.offset().top - 65
                    }, 1000);
                    return false;
                }
            }
        });
    });
</script>

Upvotes: 0

Sachin
Sachin

Reputation: 765

I would suggest creating a contents section at the top of your FAQ page, which might have the questions ordered for example.

This can be achieved by creating an Ordered List, and listing your questions.

Then you can link your questions, so that when the person clicks on the question, he is directed to the exact location where the page is. This can be achieved using anchors, just like Yavor said.

You will first need to create an ID for each question, for example :

<div id="question1">Here is a question</div>
<div>Here is the answer to the question</div>

And then in the ordered menu, create an anchor to the corresponding question in your FAQ:

<ul><li><a href="#question1">This will take you to question 1</a></li></ul>

Upvotes: 1

Yavor
Yavor

Reputation: 713

You can use anchors.

Example from w3schools:

Add an id attribute to any element:

<a id="tips">Useful Tips Section</a>

Then create a link to the element (Useful Tips Section):

<a href="#tips">Visit the Useful Tips Section</a>

Or, create a link to the element (Useful Tips Section) from another page:

<a href="http://www.w3schools.com/html_links.htm#tips">Visit the Useful Tips Section</a> 

http://www.w3schools.com/html/html_links.asp

Upvotes: 1

Related Questions