You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改Quarto网站主页?当前总是重定向至About页面

解决Quarto网站自动重定向至about页面的问题

你的Quarto网站自动跳转到about页面,核心原因是没有明确指定主页文件——Quarto默认优先识别index.qmd作为主页,若项目中不存在该文件,会自动选取导航栏里第一个可访问的页面(也就是你的about.qmd)。

你可以通过两种方式解决:

方式1:在配置中明确指定主页

在website配置节点下添加homepage字段,直接指向你的主页文件Quartopage.qmd,修改后的完整配置如下:

project: 
  type: website

website: 
  title: "Kansas Economic Data"
  # 新增主页指定配置
  homepage: Quartopage.qmd
  page-footer:
    background: dark
    left: 
      - text: "GitHub Repo"
        url: "https://github.com/wsuppmc/driving-adoption-metrics"
    center:
      - text: "™"

  navbar: 
    background: dark
    search: true
    right: 
      - text: "Home"
        file: Quartopage.qmd
      - about.qmd
  

format: 
  html:
    embed-resources: true
    page-layout: full
    toc: false
    css: styles.css
    footer: footer.html

方式2:重命名主页文件为index.qmd

Quarto默认将index.qmd作为网站主页,你可以直接把Quartopage.qmd重命名为index.qmd,同时更新导航栏中的对应配置:

navbar: 
  background: dark
  search: true
  right: 
    - text: "Home"
      file: index.qmd
    - about.qmd

两种方式任选其一,修改后网站启动时就会默认加载你指定的主页,不会再自动跳转到about页面。

内容的提问来源于stack exchange,提问作者raph mwanza

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 05:22:48