diff options
| author | Jieiku | 2022-05-31 00:48:53 -0700 |
|---|---|---|
| committer | Jieiku | 2022-05-31 00:48:53 -0700 |
| commit | f7046e6094d50a9e22ce2746b3cbb5cf7e8825e6 (patch) | |
| tree | 686de16190d29a8874f345d0f894cc94005c3599 /templates | |
| parent | 7fbb144cf8cbe007a108a6b9271bfa86fe20aee2 (diff) | |
| download | abridge-f7046e6094d50a9e22ce2746b3cbb5cf7e8825e6.tar.gz abridge-f7046e6094d50a9e22ce2746b3cbb5cf7e8825e6.tar.bz2 abridge-f7046e6094d50a9e22ce2746b3cbb5cf7e8825e6.zip | |
Paginator Macro, Fonts, Search, Whitespace Cleanup
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/index.html | 20 | ||||
| -rw-r--r-- | templates/macros/head.html | 8 | ||||
| -rw-r--r-- | templates/macros/macros.html | 25 | ||||
| -rw-r--r-- | templates/macros/social.html | 2 |
4 files changed, 33 insertions, 22 deletions
diff --git a/templates/index.html b/templates/index.html index c17ee63..9c25da9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -40,25 +40,7 @@ </p> </article> {%- endfor %} - {%- if paginator.previous or paginator.next %} - <nav> - <div>{%- if paginator.previous %}<a href="{{ paginator.previous | safe }}">< Previous</a> {% endif %} </div> - <div> - <ul> - {%- for pager in range(start=1, end=paginator.number_pagers+1) %} - <li> - {%- if pager == 1 %} - <a class="pag {% if paginator.current_index == pager %}cnav{% endif %}" href='{{ get_url(path="/", trailing_slash=true) }}'>{{pager}}</a> - {%- else %} - <a class="pag {% if paginator.current_index == pager %}cnav{% endif %}" href='{{ paginator.base_url }}{{pager}}'>{{pager}}</a> - {%- endif %} - </li> - {%- endfor %} - </ul> - </div> - <div>{%- if paginator.next %}<a href="{{ paginator.next | safe }}">Next ></a>{% endif %} </div> - </nav> - {%- endif %} + {{- macros::pagination(paginator=paginator) }} </div> {%- set section_item = get_section(path="_index.md") %} {%- if config.extra.recent | default(value=true) %} diff --git a/templates/macros/head.html b/templates/macros/head.html index 6216830..0107b83 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -6,9 +6,9 @@ {%- macro resource() %} {%- if config.extra.fonts_load and config.extra.fonts %}{%- for i in config.extra.fonts %} {%- if i.url is matching("^http[s]?://") %} - <link rel="preload" as="style" href="{{ i.url | safe }}"> + <link rel="preload" href="{{ i.url | safe }}" as="style" onload="this.onload=null;this.rel='stylesheet'" crossorigin="anonymous"> {%- else %} - <link rel="preload" as="font" href="{{ get_url(path=i.url, trailing_slash=false, cachebust=true) }}"> + <link rel="preload" href="{{ get_url(path=i.url, trailing_slash=false) }}" as="style" onload="this.onload=null;this.rel='stylesheet'" crossorigin="anonymous"> {%- endif %} {%- endfor %}{%- endif %} @@ -17,8 +17,12 @@ {%- endif %} {%- if config.build_search_index %} + {%- if config.extra.js_search_index %} <script defer type="text/javascript" src="{{ get_url(path=config.extra.js_search_index, trailing_slash=false, cachebust=true) | safe }}"></script> + {%- endif %} + {%- if config.extra.js_search %} <script defer type="text/javascript" src="{{ get_url(path=config.extra.js_search, trailing_slash=false, cachebust=true) | safe }}"></script> + {%- endif %} {%- endif %} {%- if config.generate_feed %} diff --git a/templates/macros/macros.html b/templates/macros/macros.html index 82e856a..a639a73 100644 --- a/templates/macros/macros.html +++ b/templates/macros/macros.html @@ -19,3 +19,28 @@ {%- macro footer(page) %} <h3><a href="#">Back to top</a></h3> {%- endmacro footer %} + + +{%- macro pagination(paginator)%} + {%- if paginator.number_pagers > 1 %} + <nav> + <div>{%- if paginator.previous %}<a href="{{ paginator.previous | safe }}">< Previous</a> {% endif %} </div> + <div> + <ul> + {%- for i in range(start=1, end=paginator.number_pagers+1) %} + <li> + {%- if i == paginator.current_index %} + <a class="cnav" href="#">{{i}}</a> + {%- elif i > 1 %} + <a href="{{paginator.base_url | safe }}{{i ~ '/'}}">{{i}}</a> + {%- else %} + <a href="{{paginator.first | safe }}">{{i}}</a> + {%- endif %} + </li> + {%- endfor %} + </ul> + </div> + <div>{%- if paginator.next %}<a href="{{ paginator.next | safe }}">Next ></a>{% endif %} </div> + </nav> + {%- endif %} +{%- endmacro %} diff --git a/templates/macros/social.html b/templates/macros/social.html index 05eeb82..37c66af 100644 --- a/templates/macros/social.html +++ b/templates/macros/social.html @@ -40,7 +40,7 @@ {%- if social_config.youtube %} <a href="https://www.youtube.com/channel/{{ social_config.youtube }}/" target="_blank"><span class="svg youtube" title="YouTube"></span></a>{% endif %} {%- if social_config.buymeacoffee %} - <a href="https://www.buymeacoffee.com/{{ social_config.buymeacoffee }}" target="_blank"><span class="svg buymeacoffee" title="Buy Me A Coffee"></span></a>{% endif %} + <a href="https://www.buymeacoffee.com/{{ social_config.buymeacoffee }}/" target="_blank"><span class="svg buymeacoffee" title="Buy Me A Coffee"></span></a>{% endif %} {%- if social_config.github_sponsor %} <a href="https://github.com/sponsors/{{ social_config.github_sponsor }}/" target="_blank"><span class="svg github-sponsor" title="GitHub Sponsor"></span></a>{% endif %} </span> |
