1.8 KiB
1.8 KiB
+++ date = "2017-05-28" tags = ["blog"] title = "middleman-auto-scroll" slug = "blog" +++
middlemanの場合、/page/3
のところを../3
とかなってハマる。
https://github.com/gilbitron/Infiniscroll
layout.slim
- paginate = current_page.metadata[:locals]["paginate"]
- num_pages = current_page.metadata[:locals]["num_pages"]
- page_number = current_page.metadata[:locals]["page_number"]
- prev_page = current_page.metadata[:locals]["prev_page"]
- next_page = current_page.metadata[:locals]["next_page"]
.content
- if paginate && num_pages > 1
.pager
- if prev_page
= link_to "./page/#{page_number-1}", class: "prev"
|前のページ
//= link_to prev_page, class: "prev"
// |前のページ
- else
.pager__prev
- if next_page
= link_to "./page/#{page_number+1}", class: "next"
| 次のページ
//= link_to next_page, class: "next"
// | 次のページ
- else
.pager__next
.loading
Ref :
これでもscroll.jsのread時にhttpsではないのでhttp://example.com/page/2/
とかなってハマる。set :relative_links, true
をsetしている場合はfalse
にするといい。
Mixed Content: The page at 'https://blogm.syui.ai/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://blogm.syui.ai/page/2/'. This request has been blocked; the content must be served over HTTPS.
config.rb
configure :build do
activate :asset_host, :host => 'https://example.com'
activate :asset_hash
#set :relative_links, true
end
- "./page/#{page_number+1}"
+ "/page/#{page_number+1}"