greenelab/lab-website-template

Hyphen in member name not showing in member page heading or tab title

houdak opened this issue · 4 comments

Hello, I'm in the process of using this template to make our lab website. One small issue I'm running into is that a lab member has a hyphen in her name. (ex. her name is Mary-Jo Smith). The name that shows up on the "people" page matches what I put as her name in her file under _members, but what is showing up on her own page is the name based on the file (i.e. the file name is mary-jo-smith.md so her name shows as Mary Jo Smith, without the hyphen).

I haven't figured out a way to get the hyphen to display. Ideally the name on all pages would be based on what is typed in inside the md file, rather than the file name itself. Thanks for your support on this.

Thank you for reporting this. I'm surprised/embarrassed I didn't catch this.

I will be pushing a fix shortly, but in the meantime (and if you don't want to go through the difficult process of updating your version of the template), you can do this to fix it.

Go into _layouts/member.html and change the <h1> line to:

<h1>{{ page.name | default: page.title }}</h1>

This will use the name you put in the member's .yaml front matter for the top of the page (with the filename as a fallback if name is not specified).

Awesome, thanks for the quick response. That fixed it. I did the same for

{%- capture text -%}
  {{ page.name | page.title }}'s papers
{%- endcapture -%}

in the same layout. The only other place I see that this occurs is in the name of the page (i.e. the text you see on the browser tab). Thanks again!

Another good catch! I've also looked through the code, and believe I've caught all this places where this might occur. Take a look at this hot-fix commit to see all of the things you should probably change:

506639e

Ah, I missed something else with that last hot fix, apologies. Please also see this commit:

c20535e

This is needed because apparently, if the user hasn't set name in the page front matter, Jekyll auto-populates the page.name field with the filename for some reason, usually index.md. This change attempts to detect whether the user or jekyll has set page.name.