Offer an easy way to only have a restricted apps

master
Adam Schmalhofer 2022-01-19 18:25:39 +01:00
parent 38170905ca
commit 03f8642f77
1 changed files with 14 additions and 3 deletions

View File

@ -1,4 +1,8 @@
--- ---
# uncomment the following line if you only want explicitly listed
# apps to be available on your site
# restricted: ["boot", "launch", "antonclk", "health", "setting", "about", "widbat", "widbt", "widlock", "widid"]
--- ---
{% comment %} {% comment %}
================================================================= =================================================================
@ -12,14 +16,21 @@
================================================================= =================================================================
{% endcomment %} {% endcomment %}
{%- assign apps = site.static_files | where: "name", "metadata.json" -%} {%- if page.restricted == nil -%}
{%- assign apps = site.static_files | where: "name", "metadata.json" | map: "path" -%}
{%- else -%}
{%- capture temp -%}
{%- for app in page.restricted %} /apps/{{app}}/metadata.json {%- endfor -%}
{%- endcapture -%}
{%- assign apps = temp | strip | split: " " -%}
{%- endif -%}
[ [
{%- include_relative {{ apps.first.path }} -%} {%- include_relative {{ apps.first }} -%}
{%- for app in apps offset:1 -%} {%- for app in apps offset:1 -%}
,{%- include_relative {{ app.path }} -%} ,{%- include_relative {{ app }} -%}
{%- endfor -%} {%- endfor -%}
] ]