Skip to content

Linking of page within page #6130

@PiyankaYadav

Description

@PiyankaYadav

Hello everyone I need help regarding linking of pages in nextjs. actually I know how to link but what i want is following: I have my home page having course team contact links in navbar so when I click course then course page gets open with url "localhost:3000/course" and in that course page I have courses . I want that by clicking on any course in course page it should get open and the url should be "localhost:3000/course/course_1"

`const Header = () => (

  • Home
  • Team
  •         <li>
               <a href="/courses" className="nav-link" >Course</a>
            </li>    
    
            <li >
               <a href="/contact" className="nav-link" >Contact</a>
            </li>
        </ul>
        <form className="form-inline my-2 my-lg-0">
            <div className="d-flex justify-content-center h-100">
                <div className="searchbar">
                    <input className="search_input text-center" type="text" name="" placeholder="Search..." />
                    <a href="#" className="search_icon"><i className="fas fa-search"></i></a>
                </div>
            </div>
        </form>
    </div>
    
`

This is my Course -
`const Course = () => (

    <a className="img-card img-part-2" href="#">
      <img src="/static/course1-img.jpg" />
    </a>
    <div className="teacher-img">
      <div className="ava">
         <img alt="Admin bar avatar" src="http://ivy-school.thimpress.com/demo-3/wp-content/uploads/learn-press-profile/5/2448c53ace919662a2b977d2be3a47c5.jpg" className="avatar avatar-68 photo" height="68" width="68" />
      </div>
    </div>
    <div className="card-content">
       <p className="card-para">Charlie Brown </p>
       <h4 className="card-title">
         <a href="/Pyhton">
            Learn Python – Interactive <br/> Python
         </a>
       </h4>
       <div className="info-course">
           <span className="icon1&-txt">
             <i className="fas fa-user"></i>
              &nbsp;&nbsp;3549
           </span>

           <span className="icon2&-txt">
             <i className="fas fa-tags"></i>
             &nbsp;&nbsp;education
           </span>

           <span className="icon3&-txt">
              <i className="fas fa-star"></i>
              &nbsp;&nbsp;0
           </span>
       </div>
    </div>
 </div>
`

The courses component-
`import Layout from '../components/Layout';
import Course_parent from '../components/home/Course_page/Course_parent'
import Python from '../pages/Python'

export default () => (

    <Layout>
        <div>

            <h1 className="our-course text-center">Our Course</h1>
            <Course_parent />

            <Python/>

        


        </div>
    </Layout>`

I am able to go to python page but the url shows localhist:3000/python which is not my purpose

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions