为什么我的内部超链接在哈巴狗中不起作用?

发布于 2025-01-16 19:09:58 字数 2463 浏览 1 评论 0原文

我正在开发一个个人博客,该博客在同一页面上有多个部分,我想通过在顶部用锚标记链接它们来导航到不同的部分。

当我单击链接时,地址栏中的 URL 会发生变化,但我无法使用 id 导航到正确的部分。这是代码结构。

extends /_includes/layout

block title
    title 

block content

    .cb-layout#view-main
        .cb-content
            .cb-tabs.-inverse
                .cb-tabs-navs
                    h3 
                        a(href="#about") ABOUT
                    h3
                        a(href="#projects") PROJECTS
                    h3
                        a(href="#contributions") CONTRIBUTIONS
                    h3
                        a(href="#social") SOCIAL
                    
                    //- .cb-tabs-nav.-active
                    //- .cb-tabs-nav
                    //- .cb-tabs-nav
                
            section.cb-outro#about
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 About
                        .cb-outro-list
                            
            
            section.cb-outro#areas-of-interest
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Areas of Interest

                        .cb-outro-list
                            

            section.cb-outro#currently-learning
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Currently Learning

                        .cb-outro-list
                            
                        

            section.cb-outro#projects
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Projects
                        .cb-outro-list

            section.cb-outro#contributions
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Open Source Contributions
                        .cb-outro-list
                            
                            
            section.cb-outro#social
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Social
                        .cb-outro-list

我是哈巴狗新手,有人可以告诉我出了什么问题吗?我长期以来一直在努力解决这个问题,任何帮助将不胜感激。

I am working on a personal blog that has multiple sections on the same page and I would like to navigate to the different sections by linking them at the top with an anchor tag.

The URL changes in the address bar when I click the link but I'm not able to navigate to the correct section with the id. Here's the code structure.

extends /_includes/layout

block title
    title 

block content

    .cb-layout#view-main
        .cb-content
            .cb-tabs.-inverse
                .cb-tabs-navs
                    h3 
                        a(href="#about") ABOUT
                    h3
                        a(href="#projects") PROJECTS
                    h3
                        a(href="#contributions") CONTRIBUTIONS
                    h3
                        a(href="#social") SOCIAL
                    
                    //- .cb-tabs-nav.-active
                    //- .cb-tabs-nav
                    //- .cb-tabs-nav
                
            section.cb-outro#about
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 About
                        .cb-outro-list
                            
            
            section.cb-outro#areas-of-interest
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Areas of Interest

                        .cb-outro-list
                            

            section.cb-outro#currently-learning
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Currently Learning

                        .cb-outro-list
                            
                        

            section.cb-outro#projects
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Projects
                        .cb-outro-list

            section.cb-outro#contributions
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Open Source Contributions
                        .cb-outro-list
                            
                            
            section.cb-outro#social
                .cb-outro-content
                    .cb-outro-container
                        .cb-outro-header
                            h2 Social
                        .cb-outro-list

I'm new to pug and can someone tell me what's wrong? I've been trying to fix this for so long and any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文