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

使用title-block-banner时如何隐藏Quarto网站标题?

移除Quarto网站页面中间的标题(使用title-block-banner时)

方法一:修改Quarto配置文件

在你的_quarto.yml配置中,将format.html下的title-block-style从default改为bare。这个设置会让Quarto仅渲染横幅图片,不再生成页面中间的标题文本。

修改后的配置片段如下:

format:
  html:
    theme: simplex
    css: styles.css
    toc: false
    title-block-banner: "Images/banner_books_wide.png"
    title-block-style: bare  # 关键修改:替换default为bare
    title-block-categories: false
    title-block-banner-color: body

方法二:通过CSS隐藏标题

如果需要保留标题块的其他元素(比如副标题、作者等),可以通过自定义CSS单独隐藏标题。在你的styles.css文件中添加以下代码:

.title-block h1 {
  display: none;
}

问题背景

我在R中搭建了一个简单的Quarto网站,代码托管在GitHub,网站部署在GitHub Pages。使用title-block-banner后,网站标题覆盖在横幅上,既无法辨认又多余(导航栏已显示标题),需要移除页面中间的网站标题。

效果截图:
网站标题覆盖在横幅上的效果

原始_quarto.yml配置:

project:
  type: website
  output-dir: docs
  
website:
  title: "Medienagentur Geschichte"
  cookie-consent: true
  navbar:
    left:
      - href: index.qmd
        text: Home
      - Aktuelles.qmd
      - Fernsehen.qmd
      - Hoerfunk.qmd
      - Kontakt.qmd
    background: "light"
 
  sidebar:
    logo: "Images/FM3_3911.jpg"
    pinned: true
    align: center
    header: "Dr. Tillmann Bendikowski"
    footer: "Leiter der Medienagentur Geschichte und erster Ansprechpartner für alle Fragen."
    
  page-footer:
    left: "2022"
    right: 
      - href: Datenschutz.qmd
      - href: Impressum.qmd
    
format:
  html:
    theme: simplex
    css: styles.css
    toc: false
    title-block-banner: "Images/banner_books_wide.png"
    title-block-style: default
    title-block-categories: false
    title-block-banner-color: body
    
editor: visual

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.05 23:25:17