Scriban GeneralLink Extension

 https://sitecore.stackexchange.com/questions/24908/accessing-link-field-values-in-a-scriban-template



This will be a basic scriban example. But we will get TEXT and URL from a General Link using a Scriban extension

  • First Add a "Rendering Variants"  a "Variants", with the same name as the Render;
  • Add a "Variant Definition" as "Default"
  • Add Scriban as "Scriban" as Name

HTML
<div class="hub-svelte-module" data-component="h131-generate-onbase-upgrade-code">
  <script class="svelte-module__data" type="application/json">
    {
      "title" : "{{ i_datasource | sc_field "Title" }}",
      "description" : "{{ i_datasource | sc_field "Description" }}",
      "subtitle" : "{{ i_datasource | sc_field "Subtitle" }}",
      "placeholder" : "{{ i_datasource | sc_field "Input Placeholder" }}",
      "ctatitle" : "{{ (get_link_text i_item 'CTA') }}",
      "ctaurl" : "{{ (get_link i_item 'CTA') }}",
      "successMessage" : "{{ i_datasource | sc_field "Success Message" }}",
      "successSubtitle" : "{{ i_datasource | sc_field "Success Subtitle" }}",
      "errorMessage" : "{{ i_datasource | sc_field "Error Message" }}"
    }
  </script>
</div>
      

Comments

Popular posts from this blog

docker elastic

Docker improve download speed

Sitecore usefull admin sites