Skip to content

Commit

Permalink
feat: add compact page layout, add page_layout option
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Feb 21, 2024
1 parent 051b50b commit c7aa04f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 12 deletions.
7 changes: 7 additions & 0 deletions src/shibuya/theme/shibuya/components/alternate-links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{%- if languages %}
{%- for item in languages %}
{%- if item[2] and item[2] != language %}
<link rel="alternate" hreflang="{{ item[2] }}" href="{{ i18n_link(item[1]) }}" />
{%- endif %}
{%- endfor %}
{% endif %}
45 changes: 45 additions & 0 deletions src/shibuya/theme/shibuya/layout/compact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% extends "base.html" %}

{%- block extrahead -%}
{% include "partials/opengraph.html" %}
{% include "components/alternate-links.html" %}
{%- endblock -%}

{%- if meta and meta.dark_code == "true" -%}
{% set dark_code = True %}
{%- elif theme_dark_code -%}
{% set dark_code = True %}
{%- else -%}
{% set dark_code = False %}
{%- endif -%}

{% block body %}
<div class="sy-page sy-container flex mx-auto">
<aside id="rside" class="sy-rside pb-3 w-64 shrink-0 order-last">
<button class="rside-close js-menu xl:hidden" aria-label="Close Table of Contents" type="button" aria-controls="rside" aria-expanded="false">
<i class="i-icon close"></i>
</button>
<div class="sy-scrollbar sy-rside-inner px-6 xl:top-16 xl:sticky xl:pl-0 pt-6 pb-4">
{%- if sidebars %}
{%- for sidebartemplate in sidebars %}
{%- include sidebartemplate %}
{%- endfor %}
{%- endif %}
</div>
</aside>
<div class="rside-overlay js-menu" role="button" aria-label="Close Table of Contents" aria-controls="rside" aria-expanded="false"></div>
<main class="w-full max-sm:max-w-full print:pt-6">
{% include "components/breadcrumbs.html" %}
<div class="flex flex-col break-words justify-between">
<div class="min-w-0 max-w-6xl px-6 pb-6 pt-8 xl:px-12">
<article class="yue{% if dark_code %} dark-code{% endif %}" role="main">
{% block content %}{{ body }}{% endblock %}
</article>
{% include "partials/article-bottom.html" %}
{% include "components/navigation.html" %}
{% include "partials/page-bottom.html" %}
</div>
</div>
</main>
</div>
{% endblock %}
8 changes: 1 addition & 7 deletions src/shibuya/theme/shibuya/layout/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

{%- block extrahead -%}
{% include "partials/opengraph.html" %}
{%- if languages %}
{%- for item in languages %}
{%- if item[2] and item[2] != language %}
<link rel="alternate" hreflang="{{ item[2] }}" href="{{ i18n_link(item[1]) }}" />
{%- endif %}
{%- endfor %}
{% endif %}
{% include "components/alternate-links.html" %}
{%- endblock -%}

{%- if meta and meta.dark_code == "true" -%}
Expand Down
1 change: 1 addition & 0 deletions src/shibuya/theme/shibuya/layout/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{%- block extrahead %}
{% include "partials/opengraph.html" %}
{% include "components/alternate-links.html" %}
{%- endblock %}

{% block body %}{{ body }}{% endblock %}
Expand Down
8 changes: 3 additions & 5 deletions src/shibuya/theme/shibuya/page.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{%- if meta and meta.layout == "landing" -%}
{% extends 'layout/landing.html' %}
{%- elif meta and meta.layout == "simple" -%}
{% extends 'layout/simple.html' %}
{%- if meta and meta.layout -%}
{% extends 'layout/' + meta.layout + '.html' %}
{% else %}
{% extends 'layout/default.html' %}
{% extends 'layout/' + theme_page_layout + '.html' %}
{%- endif -%}
1 change: 1 addition & 0 deletions src/shibuya/theme/shibuya/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ light_logo =
dark_logo =

# design
page_layout = default
accent_color = violet
dark_code =

Expand Down

0 comments on commit c7aa04f

Please sign in to comment.