Set attribute of homepage in Jekyll Minima theme</a></h1> </div> <div class="grid fw-wrap pb8 mb16 bb bc-black-075"> <div class="grid--cell ws-nowrap mr16 mb8" title="2016-01-12 19:07:53Z"> <span class="fc-light mr2">Asked</span> <time itemprop="dateCreated" datetime="2022-06-25T07:24:10.430" class="fromnow">Jun 25 '22 at 07:24</time> </div> <div class="grid--cell ws-nowrap mr16 mb8"> <span class="fc-light mr2">Active</span> <time class="fromnow" title="2022-06-25T14:23:45.980" datetime="2022-06-25T14:23:45.980">Jun 25 '22 at 14:23</a> </div> <div class="grid--cell ws-nowrap mb8" title="Viewed 324 times"> <span class="fc-light mr2">Viewed</span> 324 times </div> </div> <div id="mainbar" role="main" aria-label="questions and answers"> <div id="question" class="question" data-questionid="72752011" data-ownerid="11246348" data-score="2"> <div class="post-layout"> <div class="votecell post-layout--left"> <div class="js-voting-container grid jc-center fd-column ai-stretch gs4 fc-black-200" data-post-id="72752011"> <button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"></path></svg></button> <div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center" itemprop="upvoteCount" data-value="2">2</div> <button class="js-bookmark-btn s-btn s-btn__unset c-pointer py4"> <svg aria-hidden="true" class="svg-icon iconBookmark" width="18" height="18" viewBox="0 0 18 18"><path d="M6 1a2 2 0 00-2 2v14l5-4 5 4V3a2 2 0 00-2-2H6zm3.9 3.83h2.9l-2.35 1.7.9 2.77L9 7.59l-2.35 1.7.9-2.76-2.35-1.7h2.9L9 2.06l.9 2.77z"></path></svg> <div class="js-bookmark-count mt4" data-value=""></div> </button> </div> </div> <div class="postcell post-layout--right"> <div class="s-prose js-post-body" itemprop="text"><p>Running the following three shell commands creates a Jekyll site with the default Minima theme and serves it to the browser:</p> <pre class="lang-bash prettyprint-override"><code>jekyll new test_blog cd test_blog/ bundle exec jekyll serve </code></pre> <p>By default, the HTML <code><title></code> element of the rendered index page includes both the blog title and the description, so that it appears as follows:</p> <p><a class="external-link" href="https://i.stack.imgur.com/76PXQ.png" rel="nofollow noreferrer"><img alt="enter image description here" src="../../images/3785755712.webp"/></a></p> <p><strong>I would like to remove the description and display the only the title.</strong> Normally, the way you do this is by copying the default <code>_includes/head.html</code> to your local site directory and modifying the <code><title></code> element accordingly. But the default <code>_includes/head.html</code> includes no <code><title></code> element to speak of:</p> <pre class="lang-html prettyprint-override"><code><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> {%- seo -%} <link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}"> {%- feed_meta -%} {%- if jekyll.environment == 'production' and site.google_analytics -%} {%- include google-analytics.html -%} {%- endif -%} </head> </code></pre> <p>... nor do any of the other files in the basic Minima template, as far as I can tell by <code>grep</code>. I tried adding a line <code><title>My Literal Title</title></code> in <code>_includes/head.html</code> as well, but it seems to be get overwritten by something else, because it has no effect on the displayed title.</p> <p><strong>How can I change the formatting of the homepage title in the Jekyll Minima template?</strong></p></div> <div class="mt24 mb12"> <div class="post-taglist grid gs4 gsy fd-column"> <div class="grid ps-relative"> <a href="../../questions/tagged/jekyll" class="post-tag js-gps-track" title="show questions tagged 'jekyll'" rel="tag">jekyll</a> </div> </div> </div> <div class="mb0"> <div class="mt16 grid gs8 gsy fw-wrap jc-end ai-start pt4 mb16"> <div class="grid--cell mr16 fl1 w96"></div> <div class="post-signature owner grid--cell"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jun 25 '22 at 07:24">asked Jun 25 '22 at 07:24</time> <a href="../../users/11246348/max" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/11246348.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Max" /> </a> <div class="s-user-card--info"> <a href="../../users/11246348/max" class="s-user-card--link">Max</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">695</li> <li class="s-award-bling s-award-bling__silver" title="5 silver badges">5</li> <li class="s-award-bling s-award-bling__bronze" title="18 bronze badges">18</li> </ul> </div> </div> </div> </div> </div> </div> <div class="post-layout--right js-post-comments-component"> </div> </div> </div> <div id="answers"> <a name="tab-top"></a> <div id="answers-header"> <div class="answers-subheader grid ai-center mb8"> <div class="grid--cell fl1"> <h2 class="mb0" data-answercount="9">1 Answers<span style="display:none;" itemprop="answerCount">1</span></h2> </div> </div> </div> <a name="72753758"></a> <div id="answer-72753758" class="answer accepted-answer" data-answerid="72753758" data-ownerid="17567264" data-score="2" itemprop="acceptedAnswer" itemscope="" itemtype="https://schema.org/Answer"> <div class="post-layout"> <div class="votecell post-layout--left"> <div class="js-voting-container grid jc-center fd-column ai-stretch gs4 fc-black-200" data-post-id="72753758"> <button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"></path></svg></button> <div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center" itemprop="upvoteCount" data-value="2">2</div> <div class="js-accepted-answer-indicator grid--cell fc-green-500 py6 mtn8"><div class="ta-center"><svg aria-hidden="true" class="svg-icon iconCheckmarkLg" width="36" height="36" viewBox="0 0 36 36"><path d="m6 14 8 8L30 6v8L14 30l-8-8v-8z"></path></svg></div></div> </div> </div> <div class="postcell post-layout--right"> <div class="s-prose js-post-body" itemprop="text"><p>If modifying <code>_includes/head.html</code> to add a title element, the title will not change if the new title element is added below the <code>{%- seo -%}</code> line. Add it above that line, and the <code>|</code> and description will be removed.</p> <p>I tested this on a fresh install of Jekyll and created the <code>_includes/head.html</code> in the directory.</p></div> <div class="mb0"> <div class="mt16 grid gs8 gsy fw-wrap jc-end ai-start pt4 mb16"> <div class="grid--cell mr16 fl1 w96"></div> <div class="post-signature grid--cell"> <div class="user-info "> <div class="user-action-time">edited <span title="2022-06-25T14:23:45.980" class="relativetime">Jun 25 '22 at 14:23</span></div> <div class="user-gravatar32"></div> <div class="user-details" itemprop="author" itemscope="" itemtype="http://schema.org/Person"> <span class="d-none" itemprop="name">juicy-g</span> <div class="-flair"></div> </div> </div> </div> <div class="post-signature grid--cell"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="answered Jun 25 '22 at 12:13">answered Jun 25 '22 at 12:13</time> <a href="../../users/17567264/juicy-g" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/17567264.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="juicy-g" /> </a> <div class="s-user-card--info"> <a href="../../users/17567264/juicy-g" class="s-user-card--link">juicy-g</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">413</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="3 silver badge">3</li> <li class="s-award-bling s-award-bling__bronze" title="9 bronze badge">9</li> </ul> </div> </div> </div> </div> </div> </div> <div class="post-layout--right js-post-comments-component"> <div id="comments-72753758" class="comments js-comments-container bt bc-black-075 mt12 " data-post-id="72753758" data-min-length="15"> <ul class="comments-list js-comments-list" data-remaining-comments-count="0" data-canpost="false" data-cansee="true" data-comments-unavailable="false" data-addlink-disabled="true"> <li id="comment-128507063" class="comment js-comment " data-comment-id="128507063" data-comment-owner-id="11246348" data-comment-score="0"> <div class="js-comment-actions comment-actions"> <div class="comment-score js-comment-edit-hide"> </div> </div> <div class="comment-text js-comment-text-and-form"> <a name="comment128507063_72753758"></a> <div class="comment-body js-comment-edit-hide"> <span class="comment-copy">Neither of these solutions work. The first one produces the title `Title in index | Blog title` where `Blog title` is the `title:` given in `_config.yml`. It also registers the index itself as a "page," creating a redundant link to it in the header navigation. The second produces the title `Title in config | Write an awesome description ...` as described in my post. I want to remove the vertibar `|` and everything after it.</span> – <a href="../../users/11246348/max" title="695 reputation" class="comment-user owner">Max</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="../../questions/72752011/set-title-attribute-of-homepage-in-jekyll-minima-theme#comment128507063_72753758"><span title="2022-06-25T13:14:00.287 License: CC BY-SA 4.0" class="relativetime-clean">Jun 25 '22 at 13:14</span></a></span> </div> </div> </li> <li id="comment-128507961" class="comment js-comment " data-comment-id="128507961" data-comment-owner-id="17567264" data-comment-score="0"> <div class="js-comment-actions comment-actions"> <div class="comment-score js-comment-edit-hide"> </div> </div> <div class="comment-text js-comment-text-and-form"> <a name="comment128507961_72753758"></a> <div class="comment-body js-comment-edit-hide"> <span class="comment-copy">Your are right. I missed the part where you wanted the `|` and description removed. I noticed a strange behaviour when modifying `_includes/head.html`. I edited my answer to better respond to your question.</span> – <a href="../../users/17567264/juicy-g" title="413 reputation" class="comment-user ">juicy-g</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="../../questions/72752011/set-title-attribute-of-homepage-in-jekyll-minima-theme#comment128507961_72753758"><span title="2022-06-25T14:25:23.567 License: CC BY-SA 4.0" class="relativetime-clean">Jun 25 '22 at 14:25</span></a></span> </div> </div> </li> <li id="comment-128514315" class="comment js-comment " data-comment-id="128514315" data-comment-owner-id="11246348" data-comment-score="1"> <div class="js-comment-actions comment-actions"> <div class="comment-score js-comment-edit-hide"> <span title="number of 'useful comment' votes received" class="warm">1</span> </div> </div> <div class="comment-text js-comment-text-and-form"> <a name="comment128514315_72753758"></a> <div class="comment-body js-comment-edit-hide"> <span class="comment-copy">Thank you. I was able to get the behavior I wanted using `<title>{%- if page.title -%}{{page.title}} | {{site.title}}{%- else -%}{{site.title}}{%- endif -%}`. I think the buggy behavior has to do with the order of the parsers and whether `|` gets interpreted as a part of the string or as a switch, since in other contexts `{{ a | b}}` interpolates `a` if it is defined and `b` if not. – Max Jun 26 '22 at 00:30