cayman icon indicating copy to clipboard operation
cayman copied to clipboard

Title is not working

Open DrSHendricks opened this issue 3 years ago • 14 comments

I was updating my page title today., then it appears that the readme headline shows on the page title rather than the title I set in _config.yml. I cleaned cookies but it is still not working. Can you help, please?

DrSHendricks avatar Jul 28 '21 09:07 DrSHendricks

I'm getting the same problem with the title from my _config.yml file not being applied. I'm using the remote_theme. I swap out to other themes and the problem goes away, so it's an issue with the cayman theme v0.2.0.

brettChapman avatar Aug 12 '21 03:08 brettChapman

Anyone with a solution besides changing the theme?

channelcharting avatar Aug 20 '21 16:08 channelcharting

Having this issue too.

ddejohn avatar Aug 22 '21 05:08 ddejohn

Same issue here...

crobbo avatar Nov 17 '21 22:11 crobbo

Running into the same issue trying to set up a portfolio page.

Treahall avatar Dec 02 '21 02:12 Treahall

same issue here with the cayman theme in this repo

jkingslake avatar Dec 17 '21 16:12 jkingslake

Hi guys

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 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1> with this line <h1 class="project-name">{{ site.title | default: site.github.repository_name }}</h1>
  • And replace this line <h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2> with <h2 class="project-tagline">{{ site.description | default: site.github.project_tagline }}</h2>
  • 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 avatar Dec 22 '21 15:12 BenSouchet

@BenSouchet For myself, it was simple enough to get title working by copying over default.html from Cayman Themes to my own repo. I did not have to do any replacing as your post recommends. I kept the lines:

<h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>

<h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>

Not sure why my page started working without doing your recommended changes as you can see on my website: pippim/github.io

To reiterate, at first my title wasn't working either, but copying over default.html appeared to have accidentally fixed it. Perhaps I changed something else and forgot about it 1K commits ago...

pippim avatar Dec 23 '21 02:12 pippim

Hi @pippim

This is due to a second workaround, maybe a simpler than my previous message. To force the variable page.title to be the string you want you can overwrite it at the beginning of your "index.md" file. To do that you need to add these line at the top of your "index.md" file:

---
title: The title you want for the site
---

This is called front matter YAML syntax, this is used to add and / or overwrite variable used on the front (HTML files and Markdown files)

@pippim you added theses line in your "index.md" file, as you can see in the screenshot below: Screenshot 2021-12-23 at 11 50 56 So this is why in your case the title "work", I think the copy of "default.html" wasn't necessary.

Info for advanced users

This syntax seems not working currently on HTML layouts file, only working on Markdown (.md) files. This is weird since the official documentation indicate that it's working on HTML and MD, maybe an issue with BOM and UTF-8 encoding. I haven't properly checked if it's due to UTF-8

BenSouchet avatar Dec 23 '21 11:12 BenSouchet

@BenSouchet your first work around worked. :-) Thank you for your help!

jkingslake avatar Dec 23 '21 20:12 jkingslake

I have spent the whole night trying to solve this problem..I am both glad and sad to know this is actually not my problem but just a bug...I will check the work around tomorrow.

wzm2256 avatar Apr 24 '22 15:04 wzm2256

@BenSouchet It finally works! Appreciate ur help, Thanks :)

shaunyuan22 avatar Jul 28 '22 02:07 shaunyuan22

This is still a issue for me, will this be fixed or do we have to use work arounds?

PaiSolutions avatar Aug 28 '23 08:08 PaiSolutions