Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First heading appearing twice #1618

Closed
ahhz opened this issue Apr 9, 2018 · 5 comments
Closed

First heading appearing twice #1618

ahhz opened this issue Apr 9, 2018 · 5 comments

Comments

@ahhz
Copy link

ahhz commented Apr 9, 2018

Description

I am using Minimal Mistake with pages that start with a heading, as follows:

# Introduction
Blah, blah, blah

The way these pages appear is by showing the first heading twice, i.e. the word "Introduction" big and bold on two consecutive lines.

I know I can avoid this by using a YAML front matter block.

---
title: Introduction
---
Blah, blah, blah

but, I really prefer not using front matter blocks, if only because it does not appear nicely on my Github page.

Environment

Hosting on github:

https://github.com/ahhz/raster/docs
http://ahhz.github.io/raster

The following page uses the YAML front matter and looks good on the website, but not on Github:

http://ahhz.github.io/raster/rationale/
https://github.com/ahhz/raster/blob/master/docs/rationale.md

The following page does not use YAML and looks good on Github but not on the website:

http://ahhz.github.io/raster/examples/example_1/
https://github.com/ahhz/raster/blob/master/docs/examples/example_1.md

Expected behavior

Ideally I can use markdown headings without a YAML front matter block and use the _config.yml file to suppress the double heading.

Steps to reproduce the behavior

I don't think there is an error to reproduce. Just me not understanding the system, or the system not working as I would like it to.

@mmistakes
Copy link
Owner

I think you'll have to use the title attribute as that's a very common Jekyll convention.

Setting the h1 element in your Markdown file isn't something I see often. It's almost always left out and added as a title. Jekyll even goes as far as to pull the title from your .md filename if omitted.

I get the reason why you'd want to include the h1 directly in the body as it looks better when viewing source on GitHub. But it breaks some common patterns with Jekyll, not to mention SEO things... as you'll get 2 h1 elements on the page. Which isn't desirable.

You might want to poke around jekyll/jekyll or ask for suggestions on Jekyll Talk. I have to feel others have hit this (especially those who use Jekyll for site docs). There may even be a way to have Kramdown ignore # Headline when Jekyll parses it, giving you the best of both worlds.

@ahhz
Copy link
Author

ahhz commented Apr 10, 2018

Thank you, I will try these resources.

@mmistakes
Copy link
Owner

Solution is to use jekyll-titles-from-headings plugin to strip page-title and replace with body content heading.

Reference: http://talk.jekyllrb.com/t/title-derived-from-heading-appears-twice-on-top-of-page/1686/4?u=mmistakes

@ahhz
Copy link
Author

ahhz commented Apr 10, 2018

Thanks, worked for me too!

@chfast
Copy link

chfast commented Apr 11, 2020

Do you know if that should also work for GitHub Pages using minimal-mistakes as remote theme? Somehow I cannot make it work for me.

skilled-reflection added a commit to skilled-reflection/website that referenced this issue Apr 24, 2023
skilled-reflection added a commit to skilled-reflection/website that referenced this issue Apr 24, 2023
move h1 to title, per mmistakes/minimal-mistakes#1618

Titles, clean up and light edit
okitem pushed a commit to okmalls/okmalls.github.io that referenced this issue Sep 21, 2024
okitem pushed a commit to okmalls/okmalls.github.io that referenced this issue Sep 21, 2024
## [7.0.0](cotes2020/jekyll-theme-chirpy@v6.5.5...v7.0.0) (2024-05-11)

### ⚠ BREAKING CHANGES

* optimize the resource hints (mmistakes#1717)
* rename media-url file and related parameters (mmistakes#1651)
* rename comment setting parameter (mmistakes#1563)
* **analytics:** add post pageviews for GoatCounter (mmistakes#1543)

### Features

* add cloudflare web analytics ([mmistakes#1723](cotes2020/jekyll-theme-chirpy#1723)) ([c17fba4](cotes2020/jekyll-theme-chirpy@c17fba4))
* add support for embed video files ([mmistakes#1558](cotes2020/jekyll-theme-chirpy#1558)) ([9592146](cotes2020/jekyll-theme-chirpy@9592146))
* add support for giscus strict title matching ([mmistakes#1614](cotes2020/jekyll-theme-chirpy#1614)) ([700fd5b](cotes2020/jekyll-theme-chirpy@700fd5b))
* **analytics:** add post pageviews for GoatCounter ([mmistakes#1543](cotes2020/jekyll-theme-chirpy#1543)) ([b641b3f](cotes2020/jekyll-theme-chirpy@b641b3f))
* **analytics:** add Umami and Matomo tracking codes ([mmistakes#1658](cotes2020/jekyll-theme-chirpy#1658)) ([61bdca2](cotes2020/jekyll-theme-chirpy@61bdca2))
* change site verification settings ([mmistakes#1561](cotes2020/jekyll-theme-chirpy#1561)) ([e436387](cotes2020/jekyll-theme-chirpy@e436387))
* **deps:** move `MathJax` configuration to a separate file ([mmistakes#1670](cotes2020/jekyll-theme-chirpy#1670)) ([44f552c](cotes2020/jekyll-theme-chirpy@44f552c))
* display theme version in footer ([mmistakes#1611](cotes2020/jekyll-theme-chirpy#1611)) ([8349314](cotes2020/jekyll-theme-chirpy@8349314))
* **i18n:** allow `page.lang` to override `site.lang` ([mmistakes#1586](cotes2020/jekyll-theme-chirpy#1586)) ([547b95c](cotes2020/jekyll-theme-chirpy@547b95c))
* make post description customizable ([mmistakes#1602](cotes2020/jekyll-theme-chirpy#1602)) ([f865336](cotes2020/jekyll-theme-chirpy@f865336))
* **media:** support audio and video tag with multi sources ([mmistakes#1618](cotes2020/jekyll-theme-chirpy#1618)) ([23be416](cotes2020/jekyll-theme-chirpy@23be416))

### Bug Fixes

* make TOC title and entries visible at the same time ([mmistakes#1711](cotes2020/jekyll-theme-chirpy#1711)) ([e0950fc](cotes2020/jekyll-theme-chirpy@e0950fc))
* mode toggle not outlined when receiving keyboard focus ([mmistakes#1690](cotes2020/jekyll-theme-chirpy#1690)) ([cd37f63](cotes2020/jekyll-theme-chirpy@cd37f63))
* prevent footnote back arrow from becoming an emoji ([mmistakes#1716](cotes2020/jekyll-theme-chirpy#1716)) ([8608147](cotes2020/jekyll-theme-chirpy@8608147))
* **pwa:** skip range requests in service worker ([mmistakes#1672](cotes2020/jekyll-theme-chirpy#1672)) ([76d58fe](cotes2020/jekyll-theme-chirpy@76d58fe))
* search result prompt is empty ([mmistakes#1583](cotes2020/jekyll-theme-chirpy#1583)) ([8a2afae](cotes2020/jekyll-theme-chirpy@8a2afae))
* use `https` for Weibo sharing URL ([mmistakes#1612](cotes2020/jekyll-theme-chirpy#1612)) ([8e5fbb7](cotes2020/jekyll-theme-chirpy@8e5fbb7))

### Improvements

* improve <hr> visibility in dark mode ([mmistakes#1565](cotes2020/jekyll-theme-chirpy#1565)) ([4ddd5c4](cotes2020/jekyll-theme-chirpy@4ddd5c4))
* lean bootstrap javascript ([mmistakes#1734](cotes2020/jekyll-theme-chirpy#1734)) ([ddb48ed](cotes2020/jekyll-theme-chirpy@ddb48ed))
* rename comment setting parameter ([mmistakes#1563](cotes2020/jekyll-theme-chirpy#1563)) ([f8390d4](cotes2020/jekyll-theme-chirpy@f8390d4))
* replace jQuery with Vanilla JS ([mmistakes#1681](cotes2020/jekyll-theme-chirpy#1681)) ([fe7afa3](cotes2020/jekyll-theme-chirpy@fe7afa3))
* simplify mode toggle script ([mmistakes#1692](cotes2020/jekyll-theme-chirpy#1692)) ([d4a6d64](cotes2020/jekyll-theme-chirpy@d4a6d64))
* tree shaking Bootstrap CSS ([mmistakes#1736](cotes2020/jekyll-theme-chirpy#1736)) ([363a3d9](cotes2020/jekyll-theme-chirpy@363a3d9))

### Changes

* optimize the resource hints ([mmistakes#1717](cotes2020/jekyll-theme-chirpy#1717)) ([dcb0add](cotes2020/jekyll-theme-chirpy@dcb0add))
* rename media-url file and related parameters ([mmistakes#1651](cotes2020/jekyll-theme-chirpy#1651)) ([9f8aeaa](cotes2020/jekyll-theme-chirpy@9f8aeaa))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants