Skip to content

Commit 95ed4c3

Browse files
authored
Liquid now can be used in page titles (#60)
Signed-off-by: Hofi <[email protected]>
2 parents e8fbda1 + 638ec9b commit 95ed4c3

File tree

11 files changed

+28
-26
lines changed

11 files changed

+28
-26
lines changed

_data/navigation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,6 @@ doc-guide-nav:
12491249
- title: "Self made helper tools"
12501250
url: /doc-guide/02_Tools/01_Self_made_tools/README
12511251
subnav:
1252-
- title: "Self made tools testing"
1252+
- title: "This's a self made tools testing page of {{ site.title }}"
12531253
url: /doc-guide/02_Tools/01_Self_made_tools/01_Tests/README
12541254
subnav:

_includes/breadcrumbs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<span class="sep">{{ site.data.ui-text[site.locale].breadcrumb_separator | default: "/" }}</span>
2727
{% endif %}
2828
{% if forloop.last %}
29-
<li class="current">{{ page.title }}</li>
29+
<li class="current">{{ page.title | liquify | markdownify | strip_html | strip_newlines }}</li>
3030
{% else %}
3131
{% assign i = i | plus: 1 %}
3232
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">

_includes/nav_list_add

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

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

@@ -45,9 +45,9 @@
4545
{% 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 %}
4646

4747
{% if nav.url %}
48-
<a href="{{ nav.url | relative_url }}" class="nav-link {{active}}{% if levelDepth < 2 %} {{titleStyle}}{% endif %}">{{ nav.title }}</a>
48+
<a href="{{ nav.url | relative_url }}" class="nav-link {{active}}{% if levelDepth < 2 %} {{titleStyle}}{% endif %}">{{ nav.title | liquify | markdownify | strip_html | strip_newlines }}</a>
4949
{% else %}
50-
<span>{{ nav.title }}</span>
50+
<span>{{ nav.title | liquify | markdownify | strip_html | strip_newlines }}</span>
5151
{% endif %}
5252
{% endif %}
5353
</li>

_includes/page__hero.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{% if page.header.image_description %}
1414
{% assign image_description = page.header.image_description %}
1515
{% else %}
16-
{% assign image_description = page.title %}
16+
{% assign image_description = page.title | liquify | markdownify | strip_html | strip_newlines %}
1717
{% endif %}
1818

1919
{% assign image_description = image_description | markdownify | strip_html | strip_newlines | escape_once %}
@@ -27,7 +27,7 @@ <h1 id="page-title" class="page__title" itemprop="headline">
2727
{% if paginator and site.paginate_show_page_num %}
2828
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
2929
{% else %}
30-
{{ page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" }}
30+
{{ page.title | default: site.title | liquify | markdownify | remove: "<p>" | remove: "</p>" }}
3131
{% endif %}
3232
</h1>
3333
{% if page.tagline %}

_includes/page_pagination.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
{% assign prevurl = prev.url %}
1515

1616
{% assign prevtitle = prev.title %}
17-
{% comment %}<div>prevtitle = {{ prevtitle }}</div>{% endcomment %}
17+
{% comment %}<div>prevtitle = {{ prevtitle | liquify | markdownify | strip_html | strip_newlines }}</div>{% endcomment %}
1818
{% endunless %}
1919

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

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

2626
{% assign nexttitle = next.title %}
27-
{% comment %}<div>nexttitle = {{ nexttitle }}</div>{% endcomment %}
27+
{% comment %}<div>nexttitle = {{ nexttitle | liquify | markdownify | strip_html | strip_newlines }}</div>{% endcomment %}
2828
{% endunless %}
2929

3030
{% endif %}
@@ -45,7 +45,7 @@
4545

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

5151
</a>
@@ -60,7 +60,7 @@
6060

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

6666
<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">

_includes/seo.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{% assign title_separator = site.title_separator | default: '-' | replace: '|', '&#124;' %}
88

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

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

6666
{% if seo_description %}
@@ -75,7 +75,7 @@
7575

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

_includes/social-share.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h4 class="page__share-title">{{ site.data.ui-text[site.locale].share_on_label | default: "Share on" }}</h4>
44
{% endif %}
55

6-
<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>
6+
<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>
77

88
<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>
99

_js/custom/navigation.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,6 @@ $(function () {
782782
input.trigger("select");
783783
}, 100);
784784
}
785-
// else {
786-
// // set focus back via the initial content otherwise the focus will not get back to the search input once again
787-
// $(".initial-content").find("input").focus();
788-
// }
789785

790786
if (tooltipTarget)
791787
hideTooltip(true);

_js/lunr/lunr-store.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var store = [
1515
{%- assign teaser = site.teaser -%}
1616
{%- endif -%}
1717
{
18-
"title": {{ doc.title | jsonify }},
18+
"title": {{ doc.title | liquify | markdownify | strip_html | strip_newlines| jsonify }},
1919
"excerpt":
2020
{%- if site.search_full_content == true -%}
2121
{{ doc.content | newline_to_br |
@@ -54,7 +54,7 @@ var store = [
5454
{%- assign l = true -%}
5555
{%- endif -%}
5656
{
57-
"title": {{ doc.title | jsonify }},
57+
"title": {{ doc.title | liquify | markdownify | strip_html | strip_newlines| jsonify }},
5858
"excerpt":
5959
{%- if site.search_full_content == true -%}
6060
{{ doc.content | newline_to_br |

_layouts/single.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{% include sidebar.html %}
2323

2424
<article class="page h-entry" itemscope itemtype="https://schema.org/CreativeWork">
25-
{% if page.title %}<meta itemprop="headline" content="{{ page.title | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
25+
{% if page.title %}<meta itemprop="headline" content="{{ page.title | liquify | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
2626
{% if page.excerpt %}<meta itemprop="description" content="{{ page.excerpt | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
2727
{% if page.date %}<meta itemprop="datePublished" content="{{ page.date | date_to_xmlschema }}">{% endif %}
2828
{% if page.last_modified_at %}<meta itemprop="dateModified" content="{{ page.last_modified_at | date_to_xmlschema }}">{% endif %}
@@ -33,7 +33,7 @@
3333
{% if page.title %}
3434
{% 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 %}
3535
<h1 id="page-title" class="page__title p-name page__title_decoration" itemprop="headline">
36-
<a href="{{ page.url | absolute_url }}" class="u-url nav-link" itemprop="url">{{ page.title | markdownify | remove: "<p>" | remove: "</p>" }}</a>
36+
<a href="{{ page.url | absolute_url }}" class="u-url nav-link" itemprop="url">{{ page.title | liquify | markdownify | remove: "<p>" | remove: "</p>" }}</a>
3737
</h1>
3838
{% endif %}
3939
{% comment %}<!--

doc/_doc-guide/02_Tools/01_Self_made_tools/01_Tests/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: "This's a self made tools testing page"
2+
title: "This's a self made tools testing page of {{ site.title }}"
3+
# short_title can be turned off for in-title liquid testing in the nav bar, uncomment if needed
34
short_title: "Self made tools testing"
45
id: doc-testing-page
56
subtitle: >-
@@ -10,6 +11,7 @@ subtitle: >-
1011
Linking also could work with our {% include markdown_link id='doc-own-tools' title='markdown_link liquid include' withTooltip='yes' %}.<br>
1112
One more [[destination|adm-about-glossary#bom]] id=adm-about-glossary#bom override test from subtutle.<br>
1213
Macros test ${HOST}).
14+
# this can be tested as well, but do not send to tha final version
1315
search: false
1416
---
1517

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

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

70-
[[Self page link|doc-testing-page]] test.
72+
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 }}.
7173

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

@@ -76,6 +78,10 @@ Test of forced link with anchored ID part [[Install Homebrew|dev-inst-macos#home
7678
**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`
7779
{: .notice--info}
7880

81+
Embedded [link test](https://grpc.io/docs/guides/keepalive/) from a different domain
82+
83+
Search test for RFC 3526 and RFC-3526. (you need to turn 'search: true' on temporally in the liquid header of this test page)
84+
7985
The severity of the message. `time-zone()` teszt
8086

8187
parser: Parse and segment structured messages

0 commit comments

Comments
 (0)