Skip to content

Commit 2b956fa

Browse files
authored
Bug fix: allow local builds without requiring client directory (#243)
### Description <!-- Describe what this change achieves--> Currently building the zola site locally is not possible when the clients directory is not built, as the `zola serve` command fails. This is fixed by introducing an additional boolean variable `clients_built` in the client's page frontmatter, which is set to false by default, but updates to be true when running the `init_topics_and_clients.sh` script successfully. The page loads only if this var is set to true, otherwise a "Clients page not found" message is displayed, similar to the behavior in the commands and topics documentation. ### Issues Resolved <!-- List any issues this PR will resolve. --> <!-- Example: closes #1234 --> ### Check List - [x] Commits are signed per the DCO using `--signoff` By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License. Signed-off-by: Lior Sventitzky <[email protected]>
1 parent df0857d commit 2b956fa

File tree

1 file changed

+66
-60
lines changed

1 file changed

+66
-60
lines changed

templates/client-list.html

Lines changed: 66 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,74 @@
22
{% import "macros/docs.html" as docs %}
33

44
{% block main_content %}
5-
<div class="markdown-content">
6-
{% set content_parts = section.content | split(pat="<!-- split -->") %}
7-
{{ content_parts[0] | markdown | safe }}
8-
</div>
5+
{% set client_path = section.extra.recommended_clients_paths | first %}
6+
{% set client = load_data(path = docs::client_json_path(client_path=client_path), format="json", required = false) %}
7+
{% if not client %}
8+
<strong>Clients page not found.</strong> You likely need to build the client page. See "Building additional content" in the README.md file.
9+
{% else %}
10+
<div class="markdown-content">
11+
{% set content_parts = section.content | split(pat="<!-- split -->") %}
12+
{{ content_parts[0] | markdown | safe }}
13+
</div>
914

10-
<div class="client-list">
11-
<h2>Table of Contents</h2>
12-
<ul>
13-
{% set languages = [] %}
14-
{% for path in section.extra.recommended_clients_paths %}
15-
{% set language = path | split(pat="/") | nth(n=1) %}
16-
{% if language not in languages %}
17-
{% set_global languages = languages | concat(with=language) %}
18-
{% endif %}
19-
{% endfor %}
20-
{% for language in languages %}
21-
<li><a href="#{{ language | slugify }}">{{ docs::format_language(language=language) }}</a></li>
22-
{% endfor %}
23-
<li><a href="#feature-comparison-table">Feature Comparison Table</a></li>
24-
</ul>
25-
{% for language in languages %}
26-
<div class="language-clients">
27-
<h2 id="{{ language | slugify }}">{{ docs::format_language(language=language) }}</h2>
15+
<div class="client-list">
16+
<h2>Table of Contents</h2>
17+
<ul>
18+
{% set languages = [] %}
2819
{% for path in section.extra.recommended_clients_paths %}
29-
{% set client = load_data(path = docs::client_json_path(client_path= path), format="json") %}
30-
{% if client.language == language %}
31-
<div class="client-item" >
32-
<h3 id="{{ client.name | slugify }}">{{ client.name }}</h3>
33-
<ul>
34-
<li><strong>Repo:</strong> <a href="{{ client.repo }}">{{ client.name }}</a></li>
35-
<li>
36-
<strong>Installation:</strong>
37-
{% if client.installation is iterable %}
38-
<ul>
39-
{% for installation_type in client.installation %}
40-
<li>
41-
{{ installation_type.type }}:
42-
<pre>{{ installation_type.command }}</pre>
43-
</li>
44-
{% endfor %}
45-
</ul>
46-
{% else %}
47-
<code>{{ client.installation }}</code>
48-
{% endif %}
49-
</li>
50-
<li><strong>Version:</strong> {{ client.version }}</li>
51-
<li><strong>Version Released:</strong> {{ client.version_released }}</li>
52-
<li><strong>Description:</strong> {{ client.description }}</li>
53-
<li><strong>License:</strong> {{ client.license }}</li>
54-
</ul>
55-
</div>
20+
{% set language = path | split(pat="/") | nth(n=1) %}
21+
{% if language not in languages %}
22+
{% set_global languages = languages | concat(with=language) %}
5623
{% endif %}
5724
{% endfor %}
58-
</div>
59-
{% endfor %}
60-
</div>
61-
<div class="markdown-content">
62-
{{ content_parts[1] | markdown | safe }}
63-
</div>
64-
<div id="feature-comparison-table" class = "feature-comparison-table" >
65-
{% set client_paths = section.extra.recommended_clients_paths %}
66-
{% set client_fields = section.extra.client_fields %}
67-
{% include "client-feature-table.html" %}
68-
</div>
25+
{% for language in languages %}
26+
<li><a href="#{{ language | slugify }}">{{ docs::format_language(language=language) }}</a></li>
27+
{% endfor %}
28+
<li><a href="#feature-comparison-table">Feature Comparison Table</a></li>
29+
</ul>
30+
{% for language in languages %}
31+
<div class="language-clients">
32+
<h2 id="{{ language | slugify }}">{{ docs::format_language(language=language) }}</h2>
33+
{% for path in section.extra.recommended_clients_paths %}
34+
{% set client = load_data(path = docs::client_json_path(client_path= path), format="json") %}
35+
{% if client.language == language %}
36+
<div class="client-item" >
37+
<h3 id="{{ client.name | slugify }}">{{ client.name }}</h3>
38+
<ul>
39+
<li><strong>Repo:</strong> <a href="{{ client.repo }}">{{ client.name }}</a></li>
40+
<li>
41+
<strong>Installation:</strong>
42+
{% if client.installation is iterable %}
43+
<ul>
44+
{% for installation_type in client.installation %}
45+
<li>
46+
{{ installation_type.type }}:
47+
<pre>{{ installation_type.command }}</pre>
48+
</li>
49+
{% endfor %}
50+
</ul>
51+
{% else %}
52+
<code>{{ client.installation }}</code>
53+
{% endif %}
54+
</li>
55+
<li><strong>Version:</strong> {{ client.version }}</li>
56+
<li><strong>Version Released:</strong> {{ client.version_released }}</li>
57+
<li><strong>Description:</strong> {{ client.description }}</li>
58+
<li><strong>License:</strong> {{ client.license }}</li>
59+
</ul>
60+
</div>
61+
{% endif %}
62+
{% endfor %}
63+
</div>
64+
{% endfor %}
65+
</div>
66+
<div class="markdown-content">
67+
{{ content_parts[1] | markdown | safe }}
68+
</div>
69+
<div id="feature-comparison-table" class = "feature-comparison-table" >
70+
{% set client_paths = section.extra.recommended_clients_paths %}
71+
{% set client_fields = section.extra.client_fields %}
72+
{% include "client-feature-table.html" %}
73+
</div>
74+
{% endif %}
6975
{% endblock main_content %}

0 commit comments

Comments
 (0)