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

Leap Day Theme: title issue #59

Open
Sarctiann opened this issue Nov 3, 2021 · 2 comments
Open

Leap Day Theme: title issue #59

Sarctiann opened this issue Nov 3, 2021 · 2 comments

Comments

@Sarctiann
Copy link

I already set my "title" in _config.yml but the theme shows my first Header

@BenSouchet
Copy link

BenSouchet commented Dec 22, 2021

Hi @Sarctiann

I looked into the issue and the only correct solution currently is to "create a custom layout", this is ultra easy and can be done in 1min.
The steps are:

  • On your repo where you have the _config.yml file you need to create a folder named "_layouts/" and in that new folder create a file named "default.html"
  • In that "default.html" past the content of this page.
  • Replace this line <h1>{{ page.title | default: site.title | default: site.github.repository_name }}</h1> with this line <h1>{{ site.title | default: site.github.repository_name }}</h1>
  • And replace this line <p>{{ page.description | default: site.description | default: site.github.project_tagline }}</p> with <p>{{ site.description | default: site.github.project_tagline }}</p>
  • Save the file ("default.html")
  • Wait approx 2mins for the build of your page to be fully done
  • Voilà

In you want to remove these changes to get back the original behaviour, simply delete the "_layout/" folder (that normally contains the "default.html" file we created.

For advanced users

If you want to understand the issue, this is due to the parsing of the "index.md" file, when parsed the first header title is use to set the page.title variable. In the lines I highlighted in the steps below the behaviour is first to check if the markdown as a title then only if not use the title set by the user (and if there isn't use the repository name).

Why not creating a merge request to fix this issue ?

Currently pages aren't Github priority so current merge request seems to be not checked and merged by maintainers.
Secondly I don't know if it's a bug or not, some theme as this "issue" in the HTML code, some don't have this syntax.

Conclusion

Yes there is something weird in the way the HTML of the page template is done, the documentation here is not correct, the theme don't respect the following variables by default.
But there is a solution, not ideal but still.

@BenSouchet
Copy link

Second / altermative solution

There is an other solution, maybe simpler. You can use front matter YAML syntax to "force" the title you want by editing your "index.md".

Find more details on the comment I made here.

@Sarctiann

imtiazShakil added a commit to imtiazShakil/imtiazshakil.github.io that referenced this issue Mar 28, 2024
forced to use yaml front matter, so that my given title is shown in the page

pages-themes/leap-day#59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants