How to understand a YAML script to answer questions?

234 views Asked by At

I am going to learn YAML data serialization language, and I want to answer these questions based on a YAML script. What would be the right answers?

I have learned some JSON but to differentiate YAML with JSON & to get an idea of YAML I have found this script with these questions.


{% if country('ae') %}
data:

- debug: false
modules:
  - type: bannerModule
  numPerRow: 1
  externalexternalLink: true
  banners:
    - linkUrl:  https://www.mi.com/en/about/
        imageUrl: IMAGE_BASE/{{lang()}}_banner-01.png
  - type: bannerModule
  numPerRow: 2
  banners:
    - linkUrl: "/electronics-and-mobiles/mobiles-and-accessories/mobiles-20905/xiaomi"
        imageUrl: IMAGE_BASE/{{lang()}}_cat-module-01.png
    - linkUrl: "/electronics-and-mobiles/wearable-technology/xiaomi"
      imageUrl: IMAGE_BASE/{{lang()}}_cat-module-02.png
    - linkUrl: "/home-and-kitchen/xiaomi"
      imageUrl: IMAGE_BASE/{{lang()}}_cat-module-03.png
    #linkUrl: "/electronics-and-mobiles/mobiles-and-accessories/accessories-16176/bluetooth-speakers/xiaomi?sort[by]=price&sort[dir]=desc"
    #imageUrl: IMAGE_BASE/{{lang()}}_cat-module-04.png

- modules:
  - type: bannerModule
  numPerRow: 6
  moduleHeader:
  titleText: {% if lang('en') %}Shop By Category{% else %}تسوق حسب الفئة{% endif %}
  banners:
    - linkUrl: "electronics-and-mobiles/mobiles-and-accessories/mobiles-20905/xiaomi"
      imageUrl: IMAGE_BASE/en_category-01.png
      titleText: {% if lang('en') %}Mobiles{% else %}الجوّالات{% endif %}
    - linkUrl: "/electronics-and-mobiles/mobiles-and-accessories/accessories-16176/xiaomi"
      imageUrl: IMAGE_BASE/en_category-02.png
      titleText: {% if lang('en') %}Accessories{% else %}الإكسسوارات{% endif %}
    - linkUrl: "/electronics-and-mobiles/wearable-technology/xiaomi"
      imageUrl: IMAGE_BASE/en_category-03.png
      titleText: {% if lang('en') %}Wearables{% else %}ساعات وأساور تتبع اللياقة{% endif %}
    - linkUrl: "/electronics-and-mobiles/television-and-video/xiaomi"
      imageUrl: IMAGE_BASE/en_category-04.png
      titleText: {% if lang('en') %}Audio Video{% else %}أجهزة الصوت والفيديو{% endif %}
    - linkUrl: "home-and-kitchen/xiaomi"
      imageUrl: IMAGE_BASE/en_category-05.png
      titleText: {% if lang('en') %}Home & Kitchen{% else %}أجهزة المنزل والمطبخ{% endif %}
    - linkUrl: "/xiaomi"
      imageUrl: IMAGE_BASE/{{lang()}}_category-06.png
      titleText: {% if lang('en') %}View All{% else %}عرض الكل{% endif %}

{% endif %}

{% if country('sa') %}

data:

- debug: false
modules:
  - type: bannerModule
  numPerRow: 1
  externalexternalLink: true
  banners:
    - linkUrl:  "/https://www.mi.com/en/about/"
      imageUrl: IMAGE_BASE/{{lang()}}_banner-01.png
  - type: bannerModule
  numPerRow: 2
  banners:
    - linkUrl: "/electronics-and-mobiles/mobiles-and-accessories/mobiles-20905/xiaomi"
      imageUrl: IMAGE_BASE/{{lang()}}_cat-module-01.png
    - linkUrl: "/electronics-and-mobiles/wearable-technology/xiaomi"
      imageUrl: IMAGE_BASE/{{lang()}}_cat-module-02.png
    - linkUrl: "/home-and-kitchen/xiaomi"
      imageUrl: IMAGE_BASE/{{lang()}}_cat-module-03.png
    - linkUrl: "/electronics-and-mobiles/mobiles-and-accessories/accessories-16176/bluetooth-speakers/xiaomi?sort[by]=price&sort[dir]=desc"
      imageUrl: IMAGE_BASE/{{lang()}}_cat-module-04.png

{% endif %}

  1. What yml condition sets the country selection behaviour of the page?
  2. For the first banner, how many banners will be shown in the first line?
  3. What link is set for the Audio Video page?
  4. What is en_category-01.png , what is this image about?
  5. How many category banners are there in this sample page?
  6. How many banners are there in the Saudi page?
  7. Which page is shown to a user when clicking banner-01.png ?
  8. Two links on this yml file are in the wrong format resulting in a 404 page when clicking on the banner assigned to it. Which banners are those?
  9. One banner is not active in this yml file, which banner is that?
0

There are 0 answers