Skip to content

Commit

Permalink
Liquid now can be used in page titles (#60)
Browse files Browse the repository at this point in the history
Signed-off-by: Hofi <[email protected]>
  • Loading branch information
mrgarris0n authored May 27, 2024
2 parents e8fbda1 + 638ec9b commit 95ed4c3
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion _data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,6 @@ doc-guide-nav:
- title: "Self made helper tools"
url: /doc-guide/02_Tools/01_Self_made_tools/README
subnav:
- title: "Self made tools testing"
- title: "This's a self made tools testing page of {{ site.title }}"
url: /doc-guide/02_Tools/01_Self_made_tools/01_Tests/README
subnav:
2 changes: 1 addition & 1 deletion _includes/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<span class="sep">{{ site.data.ui-text[site.locale].breadcrumb_separator | default: "/" }}</span>
{% endif %}
{% if forloop.last %}
<li class="current">{{ page.title }}</li>
<li class="current">{{ page.title | liquify | markdownify | strip_html | strip_newlines }}</li>
{% else %}
{% assign i = i | plus: 1 %}
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
Expand Down
6 changes: 3 additions & 3 deletions _includes/nav_list_add
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<input type="checkbox" id="toggle-{{levelIndex}}"/>
<label for="toggle-{{levelIndex}}" class="{{titleStyle}} {{active}}">
<a href="{{ nav.url | relative_url }}" class="nav-link">{{ nav.title }}</a>
<a href="{{ nav.url | relative_url }}" class="nav-link">{{ nav.title | liquify | markdownify | strip_html | strip_newlines }}</a>
</label>
{% endif %}

Expand All @@ -45,9 +45,9 @@
{% comment %} {% assign debugInfo = "NO subnav(" | append: nav.subnav | append: "), levelIndex: " | append: levelIndex | append: ", levelDepth: " | append: levelDepth | append: ", titleStyle: " | append: titleStyle %}<div style="color: red;">{{ debugInfo }}</div> {% endcomment %}

{% if nav.url %}
<a href="{{ nav.url | relative_url }}" class="nav-link {{active}}{% if levelDepth < 2 %} {{titleStyle}}{% endif %}">{{ nav.title }}</a>
<a href="{{ nav.url | relative_url }}" class="nav-link {{active}}{% if levelDepth < 2 %} {{titleStyle}}{% endif %}">{{ nav.title | liquify | markdownify | strip_html | strip_newlines }}</a>
{% else %}
<span>{{ nav.title }}</span>
<span>{{ nav.title | liquify | markdownify | strip_html | strip_newlines }}</span>
{% endif %}
{% endif %}
</li>
Expand Down
4 changes: 2 additions & 2 deletions _includes/page__hero.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% if page.header.image_description %}
{% assign image_description = page.header.image_description %}
{% else %}
{% assign image_description = page.title %}
{% assign image_description = page.title | liquify | markdownify | strip_html | strip_newlines %}
{% endif %}

{% assign image_description = image_description | markdownify | strip_html | strip_newlines | escape_once %}
Expand All @@ -27,7 +27,7 @@ <h1 id="page-title" class="page__title" itemprop="headline">
{% if paginator and site.paginate_show_page_num %}
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
{% else %}
{{ page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" }}
{{ page.title | default: site.title | liquify | markdownify | remove: "<p>" | remove: "</p>" }}
{% endif %}
</h1>
{% if page.tagline %}
Expand Down
10 changes: 5 additions & 5 deletions _includes/page_pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
{% assign prevurl = prev.url %}

{% assign prevtitle = prev.title %}
{% comment %}<div>prevtitle = {{ prevtitle }}</div>{% endcomment %}
{% comment %}<div>prevtitle = {{ prevtitle | liquify | markdownify | strip_html | strip_newlines }}</div>{% endcomment %}
{% endunless %}

{% comment %}<div>pagetitle = {{ page.title }}</div>{% endcomment %}
{% comment %}<div>pagetitle = {{ page.title | liquify | markdownify | strip_html | strip_newlines }}</div>{% endcomment %}

{% unless forloop.last %}
{% assign next = document[forloop.index] %}
{% assign nexturl = next.url %}

{% assign nexttitle = next.title %}
{% comment %}<div>nexttitle = {{ nexttitle }}</div>{% endcomment %}
{% comment %}<div>nexttitle = {{ nexttitle | liquify | markdownify | strip_html | strip_newlines }}</div>{% endcomment %}
{% endunless %}

{% endif %}
Expand All @@ -45,7 +45,7 @@

<div class="pager-text-container">
<div class="pager-btn-title">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</div>
<div class="pager-title">{{ prevtitle | markdownify | strip_html }}</div>
<div class="pager-title">{{ prevtitle | liquify | markdownify | strip_html | strip_newlines }}</div>
</div>

</a>
Expand All @@ -60,7 +60,7 @@

<div class="pager-text-container">
<div class="pager-btn-title">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</div>
<div class="pager-title">{{ nexttitle | markdownify | strip_html }}</div>
<div class="pager-title">{{ nexttitle | liquify | markdownify | strip_html | strip_newlines }}</div>
</div>

<svg class="pager-image-container" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" preserveAspectRatio="xMidYMid meet" data-rnwibasecard--1ghhsy9-hover="true" data-rnwi-handle="nearest">
Expand Down
6 changes: 3 additions & 3 deletions _includes/seo.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% assign title_separator = site.title_separator | default: '-' | replace: '|', '&#124;' %}

{%- if page.title -%}
{%- assign seo_title = page.title | append: " " | append: title_separator | append: " " | append: site.title -%}
{%- assign seo_title = page.title | liquify | markdownify | strip_html | strip_newlines | append: " " | append: title_separator | append: " " | append: site.title -%}
{%- endif -%}

{%- if seo_title -%}
Expand Down Expand Up @@ -60,7 +60,7 @@
<meta property="og:type" content="{{ og_type }}">
<meta property="og:locale" content="{{ site.locale | replace: "-", "_" | default: "en_US" }}">
<meta property="og:site_name" content="{{ site.title }}">
<meta property="og:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
<meta property="og:title" content="{{ page.title | default: site.title | liquify | markdownify | strip_html | strip_newlines | escape_once }}">
<meta property="og:url" content="{{ canonical_url }}">

{% if seo_description %}
Expand All @@ -75,7 +75,7 @@

{% if site.twitter.username %}
<meta name="twitter:site" content="@{{ site.twitter.username | replace: "@", "" }}">
<meta name="twitter:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
<meta name="twitter:title" content="{{ page.title | default: site.title | liquify | markdownify | strip_html | strip_newlines | escape_once }}">
<meta name="twitter:description" content="{{ seo_description }}">
<meta name="twitter:url" content="{{ canonical_url }}">

Expand Down
2 changes: 1 addition & 1 deletion _includes/social-share.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4 class="page__share-title">{{ site.data.ui-text[site.locale].share_on_label | default: "Share on" }}</h4>
{% endif %}

<a href="https://twitter.com/intent/tweet?{% if site.twitter.username %}via={{ site.twitter.username | url_encode }}&{% endif %}text={{ page.title | url_encode }}%20{{ page.url | absolute_url | url_encode }}" class="btn btn--twitter" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} Twitter"><i class="fab fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>
<a href="https://twitter.com/intent/tweet?{% if site.twitter.username %}via={{ site.twitter.username | url_encode }}&{% endif %}text={{ page.title | liquify | markdownify | strip_html | strip_newlines | url_encode }}%20{{ page.url | absolute_url | url_encode }}" class="btn btn--twitter" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} Twitter"><i class="fab fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a>

<a href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | absolute_url | url_encode }}" class="btn btn--facebook" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[site.locale].share_on_label | default: 'Share on' }} Facebook"><i class="fab fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a>

Expand Down
4 changes: 0 additions & 4 deletions _js/custom/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,6 @@ $(function () {
input.trigger("select");
}, 100);
}
// else {
// // set focus back via the initial content otherwise the focus will not get back to the search input once again
// $(".initial-content").find("input").focus();
// }

if (tooltipTarget)
hideTooltip(true);
Expand Down
4 changes: 2 additions & 2 deletions _js/lunr/lunr-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var store = [
{%- assign teaser = site.teaser -%}
{%- endif -%}
{
"title": {{ doc.title | jsonify }},
"title": {{ doc.title | liquify | markdownify | strip_html | strip_newlines| jsonify }},
"excerpt":
{%- if site.search_full_content == true -%}
{{ doc.content | newline_to_br |
Expand Down Expand Up @@ -54,7 +54,7 @@ var store = [
{%- assign l = true -%}
{%- endif -%}
{
"title": {{ doc.title | jsonify }},
"title": {{ doc.title | liquify | markdownify | strip_html | strip_newlines| jsonify }},
"excerpt":
{%- if site.search_full_content == true -%}
{{ doc.content | newline_to_br |
Expand Down
4 changes: 2 additions & 2 deletions _layouts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% include sidebar.html %}

<article class="page h-entry" itemscope itemtype="https://schema.org/CreativeWork">
{% if page.title %}<meta itemprop="headline" content="{{ page.title | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.title %}<meta itemprop="headline" content="{{ page.title | liquify | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.excerpt %}<meta itemprop="description" content="{{ page.excerpt | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
{% if page.date %}<meta itemprop="datePublished" content="{{ page.date | date_to_xmlschema }}">{% endif %}
{% if page.last_modified_at %}<meta itemprop="dateModified" content="{{ page.last_modified_at | date_to_xmlschema }}">{% endif %}
Expand All @@ -33,7 +33,7 @@
{% if page.title %}
{% comment %}<!-- <h1 id="page-title" class="page__title p-name {% if page.subtitle == null and page.description == null %} page__title_decoration{% endif %}" itemprop="headline"> -->{% endcomment %}
<h1 id="page-title" class="page__title p-name page__title_decoration" itemprop="headline">
<a href="{{ page.url | absolute_url }}" class="u-url nav-link" itemprop="url">{{ page.title | markdownify | remove: "<p>" | remove: "</p>" }}</a>
<a href="{{ page.url | absolute_url }}" class="u-url nav-link" itemprop="url">{{ page.title | liquify | markdownify | remove: "<p>" | remove: "</p>" }}</a>
</h1>
{% endif %}
{% comment %}<!--
Expand Down
10 changes: 8 additions & 2 deletions doc/_doc-guide/02_Tools/01_Self_made_tools/01_Tests/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "This's a self made tools testing page"
title: "This's a self made tools testing page of {{ site.title }}"
# short_title can be turned off for in-title liquid testing in the nav bar, uncomment if needed
short_title: "Self made tools testing"
id: doc-testing-page
subtitle: >-
Expand All @@ -10,6 +11,7 @@ subtitle: >-
Linking also could work with our {% include markdown_link id='doc-own-tools' title='markdown_link liquid include' withTooltip='yes' %}.<br>
One more [[destination|adm-about-glossary#bom]] id=adm-about-glossary#bom override test from subtutle.<br>
Macros test ${HOST}).
# this can be tested as well, but do not send to tha final version
search: false
---

Expand Down Expand Up @@ -67,7 +69,7 @@ Developer guide is a double (page title amd section heading) example with a desc

[[Installing syslog-ng|adm-install]] is a forced, (also a doubled) page link title example with a description/subtitle.

[[Self page link|doc-testing-page]] test.
This one is a [[Self page link|doc-testing-page]] test with ID, this one with the title only - This's a self made tools testing page of {{ site.title }}, and a last one with direkt liquid usage - This's a self made tools testing page of {{ site.title }}.

Test of forced link with anchored ID part [[Install Homebrew|dev-inst-macos#homebrew]].

Expand All @@ -76,6 +78,10 @@ Test of forced link with anchored ID part [[Install Homebrew|dev-inst-macos#home
**Hint:** Same again in a notice block [[Install Homebrew|dev-inst-macos#homebrew]]. If you you have syslog-ng [[installed via brew|dev-inst-macos#installation]], as a reference, you can check the dependencies of the brew built version using `brew deps syslog-ng`
{: .notice--info}

Embedded [link test](https://grpc.io/docs/guides/keepalive/) from a different domain

Search test for RFC 3526 and RFC-3526. (you need to turn 'search: true' on temporally in the liquid header of this test page)

The severity of the message. `time-zone()` teszt

parser: Parse and segment structured messages
Expand Down

0 comments on commit 95ed4c3

Please sign in to comment.