primer icon indicating copy to clipboard operation
primer copied to clipboard

Option to skip top-of page H1 link with site URL

Open epogrebnyak opened this issue 4 years ago • 8 comments

By default the Premier theme adds an H1 link with site URL on top of page. I believe the code below is responsible for this behaviour:

      {% if site.title and site.title != page.title %}
      <h1><a href="{{ "/" | absolute_url }}">{{ site.title }}</a></h1>
      {% endif %}

I would like to find out how can top-of page link can be switched off.

My initial idea is forking a repo and deleting the code above from template. I would like to learn how can add and extra custom variable in _config.yaml to make H1 with URL disappear.

I think the code will look like:

      {% if must_show and (if site.title and site.title != page.title %)}
      <h1><a href="{{ "/" | absolute_url }}">{{ site.title }}</a></h1>
      {% endif %}

My qustion is how can I introduce must_show or similar in _config.yaml

epogrebnyak avatar Aug 14 '20 20:08 epogrebnyak

I believe this was discussed in #21.

According to this comment, the initial title heading is removed if you specify the following in _config.yml:

name: Site name that appears as HTML “title”
title: null

seshrs avatar Aug 14 '20 21:08 seshrs

@seshrs thanks for the info - I think I just created a duplicate.

However - will title: null shut the display of title in <title> tag? I cannot find where it is generated.

epogrebnyak avatar Aug 15 '20 08:08 epogrebnyak

However - will title: null shut the display of title in <title> tag? I cannot find where it is generated.

You're right, adding title: null alone makes the <title> tag not render. But if you add a name: My Page Title in _config.yml in addition, the <title> tag renders. (I just tried this on one of my sites, and the <title> tag renders as expected.)

seshrs avatar Aug 16 '20 03:08 seshrs

Do you know which part of the layout is responsible for this in the repo? Сould not code responsible for

tag

epogrebnyak avatar Aug 16 '20 11:08 epogrebnyak

@epogrebnyak like you mentioned, the <title> tag is generated by the jekyll-seo-tag plugin. Here's the code that uses the name if no title is provided in _config.yml: https://github.com/jekyll/jekyll-seo-tag/blob/933b914ab27601ca29615489f0343c4417bb146a/lib/jekyll-seo-tag/drop.rb#L33-L35

seshrs avatar Aug 16 '20 14:08 seshrs

Maybe make a PR for README.md that has advice about avoiding the top header?

epogrebnyak avatar Aug 16 '20 14:08 epogrebnyak

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 25 '20 14:12 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 09 '22 02:01 stale[bot]