Handle GitHub and self-hosted repos

This commit is contained in:
Daniel J. Summers 2024-04-21 13:37:31 -04:00
parent 2e7f976d8a
commit 80d4a7880d
2 changed files with 11 additions and 7 deletions

View File

@ -1,13 +1,17 @@
<article class="content auto">
{%- assign parts = page.title | split: ' » ' -%}
{%- assign parts_count = parts | size -%}
{%- capture repo_name %}{% if parts_count == 1 %}{{ page.title }}{% else %}{{ parts[0] }}{% endif %}{% endcapture -%}
{%- assign is_github = page.metadata | value: "is_github" -%}
{%- capture repo_domain %}{% if is_github == "true" %}github.com{% else %}git.bitbadger.solutions{% endif %}{% endcapture %}
{%- capture repo_text %}{% if is_github == "true" %}GitHub{% else %}Source{% endif %}{% endcapture %}
<h1 class=project-title>
{% if parts_count == 1 -%}
{{ page.title }}<br>
<small><small>
<a href="https://git.bitbadger.solutions/bit-badger/{{ page.title }}" target=_blank rel=noopener
title="{{ parts[0] }} Git Repository">
View Source Repo
<a href="https://{{ repo_domain }}/bit-badger/{{ repo_name }}" target=_blank rel=noopener
title="{{ parts[0] }} {{ repo_text }} Repository">
View {{ repo_text }} Repo
</a>
{% if is_logged_on %} &bull; <a hx-boost=false href="{{ page | edit_page_link }}">Edit Page</a>{% endif %}
</small></small>
@ -24,9 +28,9 @@
{% if parts_count > 1 -%}
<p class=project-footer>
<a href="." title="{{ parts[0] }} Home">&laquo; {{ parts[0] }} Home</a>
<a href="https://git.bitbadger.solutions/bit-badger/{{ parts[0] }}" target=_blank rel=noopener
title="{{ parts[0] }} Git Repository">
View Source Repo
<a href="https://{{ repo_domain }}/bit-badger/{{ repo_name }}" target=_blank rel=noopener
title="{{ parts[0] }} {{ repo_text }} Repository">
View {{ repo_text }} Repo
</a>
{%- endif %}
</article>

View File

@ -1,2 +1,2 @@
Bit Badger Solutions
20240420
20240421