|
27 | 27 | // add the home and posts menu items
|
28 | 28 | ninja.data = [
|
29 | 29 | {%- for page in site.pages -%}
|
30 |
| - {%- if page.permalink == '/' -%}{%- assign about_title = page.title -%}{%- endif -%} |
| 30 | + {%- if page.permalink == '/' -%}{%- assign about_title = page.title | strip -%}{%- endif -%} |
31 | 31 | {%- endfor -%}
|
32 | 32 | {
|
33 | 33 | id: "nav-{{ about_title | slugify }}",
|
34 |
| - title: "{{ about_title }}", |
| 34 | + title: "{{ about_title | truncatewords: 13 }}", |
35 | 35 | section: "Navigation",
|
36 | 36 | handler: () => {
|
37 | 37 | window.location.href = "{{ '/' | relative_url }}";
|
|
44 | 44 | {%- for child in p.children -%}
|
45 | 45 | {%- unless child.title == 'divider' -%}
|
46 | 46 | {
|
47 |
| - {%- assign title = child.title | escape -%} |
| 47 | + {%- assign title = child.title | escape | strip -%} |
48 | 48 | {%- if child.permalink contains "/blog/" -%}{%- assign url = "/blog/" -%} {%- else -%}{%- assign url = child.url -%}{%- endif -%}
|
49 | 49 | id: "dropdown-{{ title | slugify }}",
|
50 |
| - title: "{{ title }}", |
51 |
| - description: "{{ child.description | strip_html | strip_newlines | escape }}", |
| 50 | + title: "{{ title | truncatewords: 13 }}", |
| 51 | + description: "{{ child.description | strip_html | strip_newlines | escape | strip }}", |
52 | 52 | section: "Dropdown",
|
53 | 53 | handler: () => {
|
54 | 54 | window.location.href = "{{ url | relative_url }}";
|
|
59 | 59 |
|
60 | 60 | {%- else -%}
|
61 | 61 | {
|
62 |
| - {%- assign title = p.title | escape -%} |
| 62 | + {%- assign title = p.title | escape | strip -%} |
63 | 63 | {%- if p.permalink contains "/blog/" -%}{%- assign url = "/blog/" -%} {%- else -%}{%- assign url = p.url -%}{%- endif -%}
|
64 | 64 | id: "nav-{{ title | slugify }}",
|
65 |
| - title: "{{ title }}", |
66 |
| - description: "{{ p.description | strip_html | strip_newlines | escape }}", |
| 65 | + title: "{{ title | truncatewords: 13 }}", |
| 66 | + description: "{{ p.description | strip_html | strip_newlines | escape | strip }}", |
67 | 67 | section: "Navigation",
|
68 | 68 | handler: () => {
|
69 | 69 | window.location.href = "{{ url | relative_url }}";
|
|
74 | 74 | {%- endfor -%}
|
75 | 75 | {%- for post in site.posts -%}
|
76 | 76 | {
|
77 |
| - {%- assign title = post.title | escape -%} |
| 77 | + {%- assign title = post.title | escape | strip -%} |
78 | 78 | id: "post-{{ title | slugify }}",
|
79 | 79 | {% if post.redirect == blank %}
|
80 |
| - title: "{{ title }}", |
| 80 | + title: "{{ title | truncatewords: 13 }}", |
81 | 81 | {% elsif post.redirect contains '://' %}
|
82 | 82 | // TODO: fix the svg icon position for external posts
|
83 |
| - title: '{{ title }} <svg width="1.2rem" height="1.2rem" top=".5rem" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#999" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg>', |
| 83 | + title: '{{ title | truncatewords: 13 }} <svg width="1.2rem" height="1.2rem" top=".5rem" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#999" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg>', |
84 | 84 | {% else %}
|
85 |
| - title: "{{ title }}", |
| 85 | + title: "{{ title | truncatewords: 13 }}", |
86 | 86 | {% endif %}
|
87 |
| - description: "{{ post.description | strip_html | strip_newlines | escape }}", |
| 87 | + description: "{{ post.description | strip_html | strip_newlines | escape | strip }}", |
88 | 88 | section: "Posts",
|
89 | 89 | handler: () => {
|
90 | 90 | {% if post.redirect == blank %}
|
|
97 | 97 | },
|
98 | 98 | },
|
99 | 99 | {%- endfor -%}
|
100 |
| - {%- assign news = site.news | reverse -%} |
101 |
| - {%- for item in news -%} |
102 |
| - { |
103 |
| - {%- if item.inline -%} |
104 |
| - {%- assign title = item.content | remove: '<p>' | remove: '</p>' | escape | strip -%} |
105 |
| - {%- else -%} |
106 |
| - {%- assign title = item.title | escape -%} |
107 |
| - {%- endif -%} |
108 |
| - id: "news-{{ title | slugify }}", |
109 |
| - title: '{{ title | emojify }}', |
110 |
| - description: "{{ item.description | strip_html | strip_newlines | escape }}", |
111 |
| - section: "News", |
112 |
| - {%- unless item.inline -%} |
113 |
| - handler: () => { |
114 |
| - window.location.href = "{{ item.url | relative_url }}"; |
115 |
| - }, |
116 |
| - {%- endunless -%} |
117 |
| - }, |
118 |
| - {%- endfor -%} |
119 | 100 | {%- for collection in site.collections -%}
|
120 |
| - {%- if collection.label != 'news' and collection.label != 'posts' -%} |
| 101 | + {%- if collection.label != 'posts' -%} |
121 | 102 | {%- for item in collection.docs -%}
|
122 | 103 | {
|
123 | 104 | {%- if item.inline -%}
|
124 |
| - {%- assign title = item.content | remove: '<p>' | remove: '</p>' | escape | strip -%} |
| 105 | + {%- assign title = item.content | strip_html | strip_newlines | escape | strip -%} |
125 | 106 | {%- else -%}
|
126 |
| - {%- assign title = item.title | escape -%} |
| 107 | + {%- assign title = item.title | strip_html | strip_newlines | escape | strip -%} |
127 | 108 | {%- endif -%}
|
128 | 109 | id: "{{ collection.label }}-{{ title | slugify }}",
|
129 |
| - title: '{{ title | emojify }}', |
130 |
| - description: "{{ item.description | strip_html | strip_newlines | escape }}", |
| 110 | + title: '{{ title | emojify | truncatewords: 13 }}', |
| 111 | + description: "{{ item.description | strip_html | strip_newlines | escape | strip }}", |
131 | 112 | section: "{{ collection.label | capitalize }}",
|
132 | 113 | {%- unless item.inline -%}
|
133 | 114 | handler: () => {
|
|
0 commit comments