我正在自学百里香。我正在做图像轮播。而不是像这样复制和粘贴具有不同href和说明的不同图像标签:
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="link1" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h5>IMAGE 1</h5>
<p>Image 1</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="link2" alt="Second slide">
<div class="carousel-caption d-none d-md-block">
<h5>IMAGE 2</h5>
<p>image 2</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block w-100" src="link3" alt="Third slide">
<div class="carousel-caption d-none d-md-block">
<h5>IMAGE 3</h5>
<p>image 3</p>
</div>
</div>
</div>
</div>
我想将所有这些链接和描述指定到外部yml文件中,如下所示:
carousel:
pic1:
url: "https://images.pexels.com/photos/206563/pexels-photo-206563.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260"
desc: "PIC 1"
pic2:
url: "https://images.pexels.com/photos/206563/pexels-photo-206563.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260"
desc: "PIC2"
pic3:
url: "https://images.pexels.com/photos/206563/pexels-photo-206563.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260"
desc: "PIC3"
我的问题是:有什么办法可以从胸腺中的这个yml文件中读取内容?