diff options
| author | Jieiku | 2022-05-30 22:43:55 -0700 |
|---|---|---|
| committer | Jieiku | 2022-05-30 22:43:55 -0700 |
| commit | a04e54d9fed5760e6843b74d20e8df63b8d890c6 (patch) | |
| tree | b00df20425e63bce72531b606a13b4ac4b401d12 | |
| parent | 8f70a54e8bba3e29bedea4d3cfcbca1d5b123dd1 (diff) | |
| download | abridge-a04e54d9fed5760e6843b74d20e8df63b8d890c6.tar.gz abridge-a04e54d9fed5760e6843b74d20e8df63b8d890c6.tar.bz2 abridge-a04e54d9fed5760e6843b74d20e8df63b8d890c6.zip | |
Add Page.summary fallback and Add Katex
| -rw-r--r-- | config.toml | 1 | ||||
| -rw-r--r-- | sass/_variables.scss | 4 | ||||
| -rw-r--r-- | templates/base.html | 12 | ||||
| -rw-r--r-- | templates/index.html | 12 |
4 files changed, 24 insertions, 5 deletions
diff --git a/config.toml b/config.toml index 6e6b5cc..a90847b 100644 --- a/config.toml +++ b/config.toml @@ -30,6 +30,7 @@ smart_punctuation = false # `...` to `…`, `"quote"` to `“curly”` [extra] katex_enable = false # used to to render mathematical notations, requires js +katex_auto_render = false recent = true recent_items = 9 footer_credit = true diff --git a/sass/_variables.scss b/sass/_variables.scss index 6fa3915..72adc3e 100644 --- a/sass/_variables.scss +++ b/sass/_variables.scss @@ -15,8 +15,8 @@ $enable-responsive-spacings: false !default; // Enable a centered viewport for <header>, <main>, <footer> inside <body> // Fluid layout until it reaches a defined size, then becomes a centered viewport $enable-maxwidth: true !default; -$mw:50% !default;// max-width -$mb:1000px !default;// value at which to switch from fluid layout to using max-width +$mw:60% !default;// max-width +$mb:1200px !default;// value at which to switch from fluid layout to using max-width // Enable a centered viewport for <header>, <main>, <footer> inside <body> // This option will only work if $enable-maxwidth: false diff --git a/templates/base.html b/templates/base.html index 18e1fb4..d148811 100644 --- a/templates/base.html +++ b/templates/base.html @@ -127,10 +127,18 @@ {% endif %} {% if config.build_search_index %} - <script type="text/javascript" src="{{ get_url(path="search_index.en.js", trailing_slash=false, cachebust=true) | safe }}" defer></script> - <script type="text/javascript" src="{{ get_url(path="search.min.js", trailing_slash=false, cachebust=true) | safe }}" defer></script> + <script defer type="text/javascript" src="{{ get_url(path="search_index.en.js", trailing_slash=false, cachebust=true) | safe }}"></script> + <script defer type="text/javascript" src="{{ get_url(path="search.min.js", trailing_slash=false, cachebust=true) | safe }}"></script> {% endif %} + {% if config.extra.katex_enabled %} + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous"> + <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script> + <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/mathtex-script-type.min.js" integrity="sha384-jiBVvJ8NGGj5n7kJaiWwWp9AjC+Yh8rhZY3GtAX8yU28azcLgoRo4oukO87g7zDT" crossorigin="anonymous"></script> + {% if config.extra.katex_auto_render %} + <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"></script> + {% endif %} + {% endif %} {% block extra_head %}{% endblock extra_head %} </head> <body> diff --git a/templates/index.html b/templates/index.html index 79e187a..f0740fe 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,7 +6,17 @@ {% for page in paginator.pages %} <article> {{ macros::title(page=page) }} - <p>{{ page.summary | markdown(inline=true) | safe }} <a href="{{ page.permalink | safe }}">...more</a></p> + <p> + {% if page.summary -%} + {{ page.summary | markdown(inline=true) | safe }} + {% elif page.description %} + {{ page.description | safe }} + {% elif page.content %} + {{ page.content | safe | striptags | truncate(length=150) }} + {% elif page.extra.static_thumbnail %} + {% endif -%} + <a href="{{ page.permalink | safe }}">...more</a> + </p> </article> {% endfor %} <nav> |
