From 056025d5d6f56aae9fe2117403c03b733c893653 Mon Sep 17 00:00:00 2001 From: "Kyle J. Davis" Date: Thu, 7 Aug 2025 15:15:50 -0600 Subject: [PATCH] generate once, load many Signed-off-by: Kyle J. Davis --- content/command-list/_index.md | 5 ++++ templates/command-list.html | 35 ++++++++++++++++++++++++++ templates/command-page.html | 46 ++++++++-------------------------- 3 files changed, 51 insertions(+), 35 deletions(-) create mode 100644 content/command-list/_index.md create mode 100644 templates/command-list.html diff --git a/content/command-list/_index.md b/content/command-list/_index.md new file mode 100644 index 00000000..66e33b62 --- /dev/null +++ b/content/command-list/_index.md @@ -0,0 +1,5 @@ ++++ +title = "Command List" +template = "command-list.html" +page_template = "blog-page.html" ++++ \ No newline at end of file diff --git a/templates/command-list.html b/templates/command-list.html new file mode 100644 index 00000000..bcdaf18a --- /dev/null +++ b/templates/command-list.html @@ -0,0 +1,35 @@ +{% import "macros/command.html" as commands %} + +{% set commands_entries = [] %} +{% set commands_section = get_section(path="commands/_index.md") %} +{% for page in commands_section.pages %} + + {% for json_path in [ + commands::command_json_path(slug=page.slug), + commands::command_bloom_json_path(slug=page.slug), + commands::command_json_json_path(slug=page.slug), + commands::command_search_json_path(slug=page.slug) + ] %} + {% set command_data = load_data(path= json_path, required= false) %} + {% if command_data %} + {% set command_obj_name = commands::command_obj_name(command_data= command_data) %} + {% set list_command_data_obj = command_data[command_obj_name] %} + {% set command_display = command_obj_name %} + {% if list_command_data_obj.container %} + {% set command_display = list_command_data_obj.container ~ " " ~ command_display %} + {% endif %} + {% set command_entry = [ + command_display, + page.permalink | safe, + list_command_data_obj.summary, + list_command_data_obj.group + ] %} + {% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %} + {% endif %} + {% endfor %} +{% endfor %} + +{% set alpha_entries = commands_entries | sort(attribute="0") %} +{% for entry in alpha_entries %} +
  • {{ entry[0] }}
  • +{% endfor %} diff --git a/templates/command-page.html b/templates/command-page.html index 82093fab..5b4e0980 100644 --- a/templates/command-page.html +++ b/templates/command-page.html @@ -225,34 +225,6 @@

    History

    {% block related_content %} {# Set up variables for sidebar, similar to commands.html #} -{% set_global group_descriptions = load_data(path= "../_data/groups.json", required= false) %} -{% set commands_entries = [] %} -{% set commands_section = get_section(path="commands/_index.md") %} -{% for page in commands_section.pages %} - {% for json_path in [ - commands::command_json_path(slug=page.slug), - commands::command_bloom_json_path(slug=page.slug), - commands::command_json_json_path(slug=page.slug), - commands::command_search_json_path(slug=page.slug) - ] %} - {% set command_data = load_data(path= json_path, required= false) %} - {% if command_data %} - {% set command_obj_name = commands::command_obj_name(command_data= command_data) %} - {% set list_command_data_obj = command_data[command_obj_name] %} - {% set command_display = command_obj_name %} - {% if list_command_data_obj.container %} - {% set command_display = list_command_data_obj.container ~ " " ~ command_display %} - {% endif %} - {% set command_entry = [ - command_display, - page.permalink | safe, - list_command_data_obj.summary, - list_command_data_obj.group - ] %} - {% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %} - {% endif %} - {% endfor %} -{% endfor %}
    @@ -266,14 +238,18 @@

    No commands found

    Alphabetical Command List

    - - +