From 495fb29b455cac9e902946ca2004b3c44c0c5ee5 Mon Sep 17 00:00:00 2001
From: yusanshi <meet.leiyu@gmail.com>
Date: Mon, 22 Apr 2024 23:27:21 +0800
Subject: [PATCH] Fix wrong `first_page_path` because of hard-coded `page:num`
 (#3778)

---
 _includes/paginator.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/_includes/paginator.html b/_includes/paginator.html
index bffa0794..c24d4909 100644
--- a/_includes/paginator.html
+++ b/_includes/paginator.html
@@ -1,6 +1,7 @@
 {% if paginator.total_pages > 1 %}
 <nav class="pagination">
-  {% assign first_page_path = paginator.first_page_path | default: site.paginate_path | replace: 'page:num', '' | replace: '//', '/' | relative_url %}
+  {% assign paginate_path_last = site.paginate_path | split: '/' | last %}
+  {% assign first_page_path = paginator.first_page_path | default: site.paginate_path | replace: paginate_path_last, '' | replace: '//', '/' | relative_url %}
   <ul>
     {% comment %} Link for previous page {% endcomment %}
     {% if paginator.previous_page %}