Support directory installations

- Add web log to HttpContext on first retrieval per req
- Add several DotLiquid filters
- Use int for page numbers
- Update all themes to use rel/abs link and other filters
This commit is contained in:
2022-05-21 22:55:13 -04:00
parent 63425ad806
commit cbf87f5b49
41 changed files with 658 additions and 485 deletions

View File

@@ -8,7 +8,8 @@
{%- for post in model.posts %}
<article class="item">
<h1 class="item-heading">
<a href="/{{ post.permalink }}" title="Permanent Link to &quot;{{ post.title | strip_html | escape }}&quot;">
<a href="{{ post | relative_link }}"
title="Permanent Link to &quot;{{ post.title | strip_html | escape }}&quot;">
{{ post.title }}
</a>
</h1>
@@ -24,7 +25,7 @@
</span>
{% if logged_on %}
<span>
<a href="{{ post.id | edit_post_link }}"><i class="fa fa-pencil-square-o"></i> Edit Post</a>
<a href="{{ post | edit_post_link }}"><i class="fa fa-pencil-square-o"></i> Edit Post</a>
</span>
{% endif %}
</h4>
@@ -34,12 +35,12 @@
<nav aria-label="pagination">
<ul class="pager">
{% if model.newer_link -%}
<li class="previous item"><a href="/{{ model.newer_link.value }}">&laquo; Newer Posts</a></li>
<li class="previous item"><a href="{{ model.newer_link.value }}">&laquo; Newer Posts</a></li>
{%- else -%}
<li></li>
{% endif %}
{% if model.older_link -%}
<li class="next item"><a href="/{{ model.older_link.value }}">Older Posts &raquo;</a></li>
<li class="next item"><a href="{{ model.older_link.value }}">Older Posts &raquo;</a></li>
{%- endif -%}
</ul>
</nav>
@@ -74,7 +75,7 @@
{% for cat in categories -%}
{%- assign indent = cat.parent_names | size -%}
<li class="cat-list-item"{% if indent > 0 %} style="padding-left:{{ indent }}rem;"{% endif %}>
<a href="/category/{{ cat.slug }}/" class="cat-list-link">{{ cat.name }}</a>
<a href="{{ cat | category_link }}" class="cat-list-link">{{ cat.name }}</a>
<span class="cat-list-count">{{ cat.post_count }}</span>
</li>
{%- endfor %}

View File

@@ -18,17 +18,19 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/themes/{{ web_log.theme_path }}/style.css">
{%- if is_home %}
<link rel="alternate" type="application/rss+xml" title="{{ web_log.name | escape }}" href="/feed.xml">
<link rel="alternate" type="application/rss+xml" title="{{ web_log.name | escape }}"
href="{{ "feed.xml" | relative_link }}">
<link rel="canonical" href="{{ "" | absolute_url }}">
{%- endif %}
<script src="/themes/{{ web_log.theme_path }}/djs.js"></script>
</head>
<body>
<nav class="site-header" role="navigation">
<p><a class="nav-home" href="/">{{ web_log.name }}</a></p>
<p><a class="nav-home" href="{{ "" | relative_link }}">{{ web_log.name }}</a></p>
{%- if web_log.subtitle %}<p>{{ web_log.subtitle.value }}</p>{% endif -%}
<p class="nav-spacer"></p>
{%- for page in page_list %}
<p class="desktop"><a href="/{{ page.permalink }}">{{ page.title }}</a></p>
<p class="desktop"><a href="{{ page | relative_link }}">{{ page.title }}</a></p>
{%- endfor %}
<p class="desktop">
<a href="https://devotions.summershome.org" target="_blank" rel="noopener">A Word from the Word</a>
@@ -38,7 +40,7 @@
{{ content }}
<footer class="part-1" id="links">
{%- for page in page_list %}
<p class="mobile"><a href="{{ page.permalink }}">{{ page.title }}</a></p>
<p class="mobile"><a href="{{ page | relative_link }}">{{ page.title }}</a></p>
{%- endfor %}
<p class="mobile">
<a href="https://devotions.summershome.org" target="_blank" rel="noopener">A Word from the Word</a>
@@ -143,9 +145,9 @@
</a>
&bull; Powered by <a href="https://github.com/bit-badger/myWebLog/tree/v2">myWebLog</a> &bull;
{% if logged_on %}
<a href="/admin">Dashboard</a>
<a href="{{ "admin" | relative_link }}">Dashboard</a>
{% else %}
<a href="/user/log-on">Log On</a>
<a href="{{ "user/log-on" | relative_link }}">Log On</a>
{%- endif %}
</div>
</footer>

View File

@@ -15,7 +15,7 @@
{% endif %}
<span title="Author"><i class="fa fa-user"></i> {{ model.authors | value: post.author_id }}</span>
{% if logged_on %}
<span><a href="{{ post.id | edit_post_link }}"><i class="fa fa-pencil-square-o"></i> Edit Post</a></span>
<span><a href="{{ post | edit_post_link }}"><i class="fa fa-pencil-square-o"></i> Edit Post</a></span>
{% endif %}
</h4>
<div>{{ post.text }}</div>
@@ -27,7 +27,7 @@
{% assign cat = categories | where: "id", cat_id | first %}
<span class="no-wrap">
<i class="fa fa-folder-open-o" title="Category"></i>
<a href="{{ cat.slug | category_link }}" title="Categorized under &ldquo;{{ cat.name | escape }}&rdquo;">
<a href="{{ cat | category_link }}" title="Categorized under &ldquo;{{ cat.name | escape }}&rdquo;">
{{ cat.name }}
</a> &nbsp; &nbsp;
</span>
@@ -53,16 +53,16 @@
<ul class="pager">
{% if model.newer_link -%}
<li class="previous item">
<h4 class="item-heading"><a href="/{{ model.newer_link.value }}">&laquo;</a> Previous Post</h4>
<a href="/{{ model.newer_link.value }}">{{ model.newer_name.value }}</a>
<h4 class="item-heading"><a href="{{ model.newer_link.value }}">&laquo;</a> Previous Post</h4>
<a href="{{ model.newer_link.value }}">{{ model.newer_name.value }}</a>
</li>
{%- else -%}
<li></li>
{% endif %}
{% if model.older_link -%}
<li class="next item">
<h4 class="item-heading">Next Post <a href="/{{ model.older_link.value }}">&raquo;</a></h4>
<a href="/{{ model.older_link.value }}">{{ model.older_name.value }}</a>
<h4 class="item-heading">Next Post <a href="{{ model.older_link.value }}">&raquo;</a></h4>
<a href="{{ model.older_link.value }}">{{ model.older_name.value }}</a>
</li>
{%- endif -%}
</ul>