Swiper中文论坛
标题:
求助,在用Hugo搭建网站时引入Swiper CDN失败
[打印本页]
作者:
ellefik
时间:
2024-5-6 15:50
标题:
求助,在用Hugo搭建网站时引入Swiper CDN失败
封装的短代码模板如下:
{{ if .Site.Params.enableCarousel }}
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
<!-- Swiper -->
<div class="swiper">
<div class="swiper-wrapper">
{{$itItems := split (.Get 0) ","}}
{{range $itItems }}
<div class="swiper-slide">
<img src="{{.}}" alt="">
</div>
{{end}}
</div>
<!-- Add Pagination -->
<div class="swiper-pagination"></div>
</div>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<!-- Initialize Swiper -->
<script>
var swiper = new Swiper('.swiper', {
pagination: '.swiper-pagination',
paginationClickable: true,
});
</script>
{{ end }}
然后config.yaml文件里也添加了参数,custom.scss文件也定义了外观模板,确认过短代码调用格式和图片文件名、文件存储位置都没问题,但执行hugo server -D预览的时候就是显示不出来。试着生成了网站发现也没办法显示图片。请问有没有朋友有类似经验的,实在不知道问题出在哪里了orz
欢迎光临 Swiper中文论坛 (http://bbs.swiper.com.cn/)
Powered by Discuz! X3.2