Add a pagination partial
This commit is contained in:
@@ -1,27 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Title }}{{ end }}">
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
<meta name="keywords" content="">
|
||||
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title>
|
||||
<!-- Favicon -->
|
||||
<link href="/assets/images/favicon.png" rel="shortcut icon">
|
||||
<!-- CSS -->
|
||||
<link href="/assets/plugins/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/assets/plugins/owl-carousel/owl.carousel.min.css" rel="stylesheet">
|
||||
<link href="/assets/plugins/owl-carousel/owl.theme.default.min.css" rel="stylesheet">
|
||||
<link href="/assets/plugins/magnific-popup/magnific-popup.min.css" rel="stylesheet">
|
||||
<link href="/assets/plugins/scrollcue/scrollcue.css" rel="stylesheet">
|
||||
<link href="/assets/plugins/swiper/swiper-bundle.min.css" rel="stylesheet">
|
||||
<link href="/assets/css/theme.css" rel="stylesheet">
|
||||
<!-- Fonts/Icons -->
|
||||
<link href="/assets/plugins/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
|
||||
<link href="/assets/plugins/font-awesome/css/all.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="/">{{ .Site.Title }}</a>
|
||||
<a href="/posts/">Articles</a>
|
||||
</nav>
|
||||
</header>
|
||||
<body data-preloader="1">
|
||||
<!-- Header -->
|
||||
<div class="header center header-color-dark">
|
||||
<div class="container">
|
||||
<!-- Logo -->
|
||||
<div class="header-logo">
|
||||
<h3 class="uppercase letter-spacing-1"><a href="/">{{ .Site.Title }}</a></h3>
|
||||
</div>
|
||||
<!-- Menu -->
|
||||
<div class="header-menu">
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/posts/">Articles</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Menu Extra -->
|
||||
<div class="header-menu-extra">
|
||||
<ul class="list-inline-sm">
|
||||
<li><a href="#"><i class="bi bi-facebook"></i></a></li>
|
||||
<li><a href="#"><i class="bi bi-twitter-x"></i></a></li>
|
||||
<li><a href="#"><i class="bi bi-linkedin"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Menu Toggle -->
|
||||
<button class="header-toggle">
|
||||
<span></span>
|
||||
</button>
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
<!-- end Header -->
|
||||
|
||||
<main>
|
||||
{{ block "main" . }}{{ end }}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>© {{ now.Format "2006" }} {{ .Site.Title }}. Tous droits réservés.</p>
|
||||
<div class="section bg-dark">
|
||||
<div class="container">
|
||||
<div class="row g-4 align-items-center">
|
||||
<div class="col-12 col-md-6 text-center text-md-start">
|
||||
<ul class="list-inline-dash">
|
||||
<li><a href="/faq/">FAQ</a></li>
|
||||
<li><a href="/careers/">Careers</a></li>
|
||||
<li><a href="/clients/">Clients</a></li>
|
||||
</ul>
|
||||
<p class="mt-2">© {{ now.Format "2006" }} {{ .Site.Title }}, All Rights Reserved.</p>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 text-center text-md-end">
|
||||
<ul class="list-inline">
|
||||
<li><a href="#"><i class="bi bi-facebook"></i></a></li>
|
||||
<li><a href="#"><i class="bi bi-twitter-x"></i></a></li>
|
||||
<li><a href="#"><i class="bi bi-pinterest"></i></a></li>
|
||||
<li><a href="#"><i class="bi bi-instagram"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div><!-- end row -->
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Scroll to top button -->
|
||||
<div class="scrolltotop icon-lg">
|
||||
<a class="button-circle button-circle-md button-circle-dark" href="#"><i class="bi bi-arrow-up-short"></i></a>
|
||||
</div>
|
||||
<!-- end Scroll to top button -->
|
||||
|
||||
<!-- ***** JAVASCRIPTS ***** -->
|
||||
<script src="/assets/plugins/jquery.min.js"></script>
|
||||
<script src="/assets/plugins/plugins.js"></script>
|
||||
<script src="/assets/js/functions.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,27 +1,75 @@
|
||||
{{ define "main" }}
|
||||
<div class="home">
|
||||
<section class="hero">
|
||||
<h1>{{ .Site.Title }}</h1>
|
||||
<p>{{ .Content }}</p>
|
||||
</section>
|
||||
|
||||
<section class="recent-posts">
|
||||
<h2>Articles récents</h2>
|
||||
{{ range first 10 .Site.RegularPages }}
|
||||
<article class="post-preview">
|
||||
<h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
|
||||
<div class="post-meta">
|
||||
<time>{{ .Date.Format "2 Jan 2006" }}</time>
|
||||
{{ if .Params.author }}
|
||||
<span>{{ .Params.author.name }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if .Params.excerpt }}
|
||||
<p class="post-excerpt">{{ .Params.excerpt }}</p>
|
||||
{{ end }}
|
||||
<a href="{{ .RelPermalink }}" class="read-more">Lire la suite →</a>
|
||||
</article>
|
||||
{{ end }}
|
||||
</section>
|
||||
<div class="section-sm bg-gray-lighter">
|
||||
<div class="container text-center">
|
||||
<h3 class="font-family-playfair">{{ .Site.Title }} blog.</h3>
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
|
||||
<!-- Blog section -->
|
||||
<div class="section">
|
||||
<div class="container">
|
||||
<div class="row g-4">
|
||||
<div class="col-12 col-sm-10 offset-sm-1 col-md-8 offset-md-2">
|
||||
{{ $paginator := .Paginator 10 }}
|
||||
{{ range $paginator.Pages }}
|
||||
<!-- Blog Post box -->
|
||||
<div class="mb-5">
|
||||
<div class="img-link-box">
|
||||
<a href="{{ .Permalink }}">
|
||||
{{ if .Params.image }}
|
||||
<img src="{{ .Params.image }}" alt="{{ .Title }}">
|
||||
{{ else }}
|
||||
<img src="/assets/images/col-1.jpg" alt="{{ .Title }}">
|
||||
{{ end }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<div class="d-inline-flex">
|
||||
{{ if .Params.categories }}
|
||||
{{ range $index, $category := .Params.categories }}
|
||||
{{ if $index }}, {{ end }}
|
||||
{{ if and (eq (printf "%T" $category) "string") }}
|
||||
<a class="font-family-poppins font-small fw-medium uppercase" href="/categories/{{ $category | urlize }}">{{ $category }}</a>
|
||||
{{ else if and (eq (printf "%T" $category) "map") }}
|
||||
{{ if $category.name }}
|
||||
<a class="font-family-poppins font-small fw-medium uppercase" href="/categories/{{ $category.name | urlize }}">{{ $category.name }}</a>
|
||||
{{ else }}
|
||||
<a class="font-family-poppins font-small fw-medium uppercase" href="#">General</a>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<a class="font-family-poppins font-small fw-medium uppercase" href="#">General</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<a class="font-family-poppins font-small fw-medium uppercase" href="#">General</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="d-inline-flex">
|
||||
<span class="font-small">{{ .Date.Format "Jan 2, 2006" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<h4><a class="text-link-1" href="{{ .Permalink }}">{{ .Title }}</a></h4>
|
||||
{{ if .Params.excerpt }}
|
||||
<p>{{ .Params.excerpt }}</p>
|
||||
{{ else if .Summary }}
|
||||
<p>{{ .Summary }}</p>
|
||||
{{ else }}
|
||||
<p>{{ truncate 200 .Content }}</p>
|
||||
{{ end }}
|
||||
<div class="mt-3">
|
||||
<a class="button-text-1" href="{{ .Permalink }}">Read More</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Blog Post box -->
|
||||
{{ end }}
|
||||
|
||||
<!-- Pagination -->
|
||||
{{ partial "pagination.html" . }}
|
||||
</div>
|
||||
</div><!-- end row -->
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
<!-- end Blog section -->
|
||||
{{ end }}
|
||||
26
layouts/partials/pagination.html
Normal file
26
layouts/partials/pagination.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!-- Pagination -->
|
||||
{{ if gt (len .Site.RegularPages) 10 }}
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center mt-5">
|
||||
<li class="page-item {{ if not .Paginator.HasPrev }}disabled{{ end }}">
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<a class="page-link" href="{{ .Paginator.Prev.URL }}">«</a>
|
||||
{{ else }}
|
||||
<a class="page-link" href="#">«</a>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ range .Paginator.Pagers }}
|
||||
<li class="page-item {{ if eq .PageNumber $.Paginator.PageNumber }}active{{ end }}">
|
||||
<a class="page-link" href="{{ .URL }}">{{ .PageNumber }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<li class="page-item {{ if not .Paginator.HasNext }}disabled{{ end }}">
|
||||
{{ if .Paginator.HasNext }}
|
||||
<a class="page-link" href="{{ .Paginator.Next.URL }}">»</a>
|
||||
{{ else }}
|
||||
<a class="page-link" href="#">»</a>
|
||||
{{ end }}
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user