Title derived from heading appears twice on top of page

Description

I am using Minimal Mistake theme, with markdown 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 front matter block.

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

but, I really prefer not using front matter blocks, if only because they do 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 front matter block and looks good on the website, but not on Github:

http://ahhz.github.io/raster/rationale/
link: 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/
link: https://github.com/ahhz/raster/blob/master/docs/examples/example_1.md

Expected behavior

Ideally I would be able to add something to my _config.yml file to suppress the double heading.

I already asked on the Minimal Mistakes pages, but they suggest it is a more general Jekyl issue.

Steps to reproduce the behavior

I don’t think there is an error to reproduce. Just me looking for a way to let my pages appear nicely on simultaneously on Github and in the Minimal Mistakes theme.

1 Like

This may be relevant to your interests:

1 Like

Yes, I did come across that. I tried using it following the instructions, but don’t see a difference at all.

They offer:

  1. to extract the title from the heading. OK, this was already happening anyway
  2. to use a strip_title option to suppress showing the title: this would be great, but does not seem to be happening.

I think maybe you haven’t setup the plugin correctly. I just tried it and had no problems getting it to strip the title in front matter and replace with the heading in the body.

Here’s what I did.

  1. Add gem 'jekyll-titles-from-headings' to my Gemfile
  2. Run bundle update to install it
  3. Add jekyll-titles-from-headings to the plugins array in _config.yml
  4. Add the following settings to _config.yml:
    titles_from_headings:
      enabled:     true
      strip_title: true
      collections: true 
    
  5. Added a test post eg. _posts/2018-04-10-title-strip.md
---
title: "Title Strip Test Post"
---

# Title Override

This should have some content.

And, as expected “Title Strip Test Post” title was overrided with what is in the body content. Works on the post page and anywhere else it shows up (like indexes).

2 Likes

Ah, yes you are right. I had not configured the site properly to use external scripts. Now it works. Thank you for all your help. And of course thank you for sharing this beautiful and user-friendly theme.

3 Likes