Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
Add swiper to hugo

I would like to add swiper to make a slider to my test project, tha is based on hugo framework. Unfortunately, it doesn;t work correctly. Here is my github projects: https://github.com/bullet03/carousel_site

What I've done:

  1. Created a structure in layouts/_default/baseof.html, where i put partials/head.html and partials/header.html
  2. in partials/head.html i added css styles for swiper and css for my code

<link
  rel="stylesheet"
  href="https://unpkg.com/swiper/swiper-bundle.min.css"
/>

  1. in partials/header.html i inserted partials/carousel.html
  2. in partials/carousel.html i added html structure, at the end added js scripts for swiper

<!-- Swiper JS -->
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

<!-- Initialize Swiper -->
<script>
  var swiper = new Swiper(".mySwiper", {});
</script>

My css do not load, there is no mistake, it's just like there is no swiper and styles at all. Could you kindly, point out, how to fix it?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When I cloned your repo and tried to display the page, it cannot be displayed because there is no single.html file in your layouts/_default directory. This file is used by Hugo to render single pages like your a.md is (it's not a home page nor a list page).

Create a layouts/_default/single.html and put this content into it:

{{ define "main" }}
    <!-- 
        Place the content for single pages here, it will be rendered
        in a place where you'll add {{ block "main" . }}{{ end }}.
        Adding the block to your baseof.html is not necessary to
        achieve what you want to achieve (display the swiper).
    -->
{{ end }}

You don't need to add any content there unless you want to, just make sure the file exists and a block is defined inside of it.

For more information, see template lookup order.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda