feat: support dict object for get_value function

This commit is contained in:
jeffreytse 2021-01-08 11:51:40 +08:00
parent b8ed37973e
commit fcdfc7ea09

View file

@ -2,6 +2,9 @@
{%- assign name = include.params.name -%} {%- assign name = include.params.name -%}
{%- endif -%} {%- endif -%}
{%- assign keys = name | split:'.'- %}
{%- assign name = keys.first -%}
{%- if page[name] != nil -%} {%- if page[name] != nil -%}
{%- assign return = page[name] -%} {%- assign return = page[name] -%}
{%- elsif site[name] != nil -%} {%- elsif site[name] != nil -%}
@ -17,3 +20,13 @@
{%- else -%} {%- else -%}
{%- assign return = include.params.default -%} {%- assign return = include.params.default -%}
{%- endif -%} {%- endif -%}
{%- assign keys = keys | shift -%}
{%- for key in keys -%}
{%- assign return = return[key] -%}
{%- if return == nil -%}
{%- assign return = include.params.default -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}