diff options
author | Vanja Cosic <1070957+vanjacosic@users.noreply.github.com> | 2023-10-28 18:23:13 +0200 |
---|---|---|
committer | Vanja Cosic <1070957+vanjacosic@users.noreply.github.com> | 2023-10-28 18:23:13 +0200 |
commit | 788c1bb279d9ce706ba6811c0dc2484c1a732106 (patch) | |
tree | 6c567d810d379d16bc56cf78f9cb3c930c7a6a10 /templates | |
parent | e028ac38509a954a7d8808962dd57d400142ef64 (diff) | |
download | cph-rust-website-788c1bb279d9ce706ba6811c0dc2484c1a732106.zip |
Major redesign of the site
Affects structure, navigation, styles (light and dark mode), event data
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base.html | 43 | ||||
-rw-r--r-- | templates/event-page.html | 20 | ||||
-rw-r--r-- | templates/events.html | 26 | ||||
-rw-r--r-- | templates/index.html | 85 | ||||
-rw-r--r-- | templates/macros.html | 40 | ||||
-rw-r--r-- | templates/page.html | 46 |
6 files changed, 96 insertions, 164 deletions
diff --git a/templates/base.html b/templates/base.html index 1e1f2d6..fa0ebb0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -11,32 +11,31 @@ </head> <body> - {% block header %} <header> - <nav> - <img class="logo" src="/cph-rs-ferris.png"> - <a href="./"> - <h1>Copenhagen Rust Community</h1> - </a> - </nav> + <a href="/"> + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 411 208"><g filter="url(#a)"><path fill="#A52B00" d="m325.003 145.462-3.526-7.303c.019-.277.033-.555.033-.834 0-8.278-8.61-15.908-23.095-22.018v5.08a101.807 101.807 0 0 0-4.416-1.633v-2.368c-20.701-7.465-51.519-12.202-85.944-12.202-30.077 0-57.403 3.616-77.634 9.508v8.249-9.985c-20.727 6.586-33.577 15.736-33.577 25.852 0 1.595.322 3.165.94 4.706l-2.111 3.758s-1.692 2.194 1.287 6.823c2.627 4.082 15.786 20.06 22.732 28.427 2.983 4.29 5.007 6.932 5.183 6.676.279-.404-1.855-8.458-7.78-17.647-2.764-4.934-6.066-11.472-8.048-16.302 5.533 3.502 38.039 19.868 104.343 19.802 67.762-.068 97.883-21.277 101.189-24.164-1.156 4.64-5.103 14.028-8.25 20.63-5.172 9.443-7.046 17.663-6.805 18.07.153.256 1.918-2.465 4.52-6.876 6.056-8.628 17.531-25.099 19.823-29.295 2.599-4.756 1.136-6.954 1.136-6.954Z"/><path fill="#F74C00" d="m345.476 145.416-23.175-17.07c-.217-.759-.435-1.519-.66-2.272l7.613-11.027a4.134 4.134 0 0 0 .429-3.858c-.506-1.273-1.611-2.185-2.918-2.409l-12.871-2.184a112.232 112.232 0 0 0-1.547-3.014l5.408-12.38a4.111 4.111 0 0 0-.298-3.87c-.735-1.15-1.982-1.822-3.312-1.77l-13.063.475c-.676-.881-1.363-1.754-2.064-2.61l3.002-13.27a4.1 4.1 0 0 0-1.019-3.736 3.72 3.72 0 0 0-3.579-1.063l-12.723 3.128a110.708 110.708 0 0 0-2.509-2.151l.458-13.622c.049-1.379-.594-2.69-1.698-3.455a3.686 3.686 0 0 0-3.71-.313l-11.869 5.643a131.937 131.937 0 0 0-2.89-1.618l-2.097-13.423c-.213-1.36-1.088-2.515-2.313-3.042a3.683 3.683 0 0 0-3.695.448l-10.582 7.94a113.29 113.29 0 0 0-3.149-.995l-4.561-12.73c-.464-1.297-1.534-2.25-2.838-2.518a3.737 3.737 0 0 0-3.539 1.191l-8.908 9.965a117.294 117.294 0 0 0-3.235-.33l-6.878-11.588c-.697-1.174-1.927-1.888-3.254-1.888-1.323 0-2.556.714-3.247 1.888l-6.881 11.588c-1.081.093-2.163.206-3.238.33l-8.909-9.965a3.741 3.741 0 0 0-3.54-1.191c-1.303.271-2.374 1.22-2.836 2.518l-4.565 12.73c-1.057.317-2.104.65-3.148.995l-10.58-7.94a3.68 3.68 0 0 0-3.7-.449c-1.221.528-2.099 1.683-2.311 3.043l-2.099 13.423c-.97.526-1.932 1.066-2.89 1.618l-11.869-5.643a3.68 3.68 0 0 0-3.71.313c-1.103.766-1.747 2.076-1.698 3.455l.457 13.622a122.92 122.92 0 0 0-2.51 2.151l-12.721-3.128a3.733 3.733 0 0 0-3.583 1.063c-.94.979-1.322 2.39-1.019 3.737l2.996 13.269c-.695.86-1.383 1.729-2.057 2.61l-13.063-.475a3.802 3.802 0 0 0-3.314 1.77 4.13 4.13 0 0 0-.3 3.87l5.412 12.38a121.85 121.85 0 0 0-1.551 3.014l-12.87 2.184c-1.308.22-2.41 1.132-2.92 2.409a4.148 4.148 0 0 0 .431 3.858l7.614 11.027c-.06.194-.113.391-.172.586l-21.525 22.864s-3.3 2.585 1.503 8.66c4.235 5.36 25.981 26.606 37.466 37.736 4.851 5.651 8.174 9.15 8.521 8.847.548-.48-2.329-10.761-11.883-22.824-7.365-10.822-16.924-27.468-14.682-29.386 0 0 2.55-3.236 7.665-5.566-.193-.148.187.15 0 0 0 0 107.954 49.793 208.091.842 11.439-2.051 18.364 4.076 18.364 4.076 2.388 1.384-3.796 18.5-8.881 29.83-6.917 12.865-7.931 22.904-7.344 23.252.37.221 2.886-3.608 6.476-9.701 8.857-12.341 25.6-35.866 28.664-41.58 3.475-6.479 0-8.294 0-8.294Z"/><path fill="#F74C00" d="M298.277 139.029s15.533-.72 35.936-21.455l2.891-6.419s-31.667-31.498 17.56-53.24c0 0-4.31 7.042-3.045 34.25 0 0 14.842-5.154 19.194-29.188 0 0 21.649 28.541-23.514 55.309 0 0-21.188 33.964-51.058 30.71l2.036-9.967Z"/><path fill="#000" d="M227.914 119.466s10.788-11.812 21.577 0c0 0 8.476 15.75 0 23.624 0 0-13.871 11.024-21.577 0 0 0-9.247-8.662 0-23.624Z"/><path fill="#fff" d="M240.402 123.85c0 4.599-2.711 8.328-6.056 8.328-3.344 0-6.055-3.729-6.055-8.328 0-4.6 2.711-8.329 6.055-8.329 3.345 0 6.056 3.729 6.056 8.329Z"/><path fill="#000" d="M179.763 116.239s18.506-8.193 23.557 10.094c0 0 5.29 21.314-15.198 22.517 0 0-26.125-5.031-8.359-32.611Z"/><path fill="#fff" d="M189.058 124.154c0 4.743-2.796 8.589-6.245 8.589-3.448 0-6.245-3.846-6.245-8.589 0-4.744 2.797-8.59 6.245-8.59 3.449 0 6.245 3.846 6.245 8.59Z"/><path fill="#000" d="m203.47 156.304 23.599-1.894s-.799 3.799-3.878 6.65c0 0-8.117 8.899-17.43-.74 0 0-1.524-1.644-2.291-4.016Z"/><path fill="#F74C00" d="M108.975 134.459c-.195 0-.386.014-.577.029-7.662-1.744-29.2-7.355-34.894-16.461 0 0 28.983-32.965-16.316-54.037l5.275 36.472s-13.965-9.33-16.978-29.599c0 0-34.006 24.677 15.008 48.328 0 0 4.446 16.702 47.128 30.028l.032-.127c.429.08.869.127 1.322.127 4.033 0 7.303-3.304 7.303-7.38 0-4.076-3.27-7.38-7.303-7.38Z"/><path stroke="gray" stroke-width="3" d="m305.061 35.52 71.161 71.161"/><path fill="#C8102E" d="M305.825 34.756 339.581 1l25.544 25.545-33.755 33.756-25.545-25.545Z"/><path fill="#fff" d="m316.773 45.704 10.947-10.948-10.947-10.948 3.649-3.65 10.948 10.949 19.158-19.159 3.65 3.65-19.159 19.158 10.948 10.948-3.65 3.65-10.947-10.949-10.948 10.948-3.649-3.65ZM71.16 1l33.757 33.756L79.372 60.3 45.616 26.545 71.161 1Z"/><path stroke="gray" stroke-width="3" d="m105.605 35.444-71.161 71.161"/><path fill="#000" d="M84.38 22.429c-4.538-4.539-11.928-4.537-16.465 0-4.537 4.537-4.537 11.928 0 16.465 4.537 4.537 11.928 4.537 16.465 0 4.537-4.537 4.537-11.928 0-16.465Zm-.743.72a.762.762 0 0 1-.016 1.067.766.766 0 1 1 .016-1.068Zm.348 2.13a9.427 9.427 0 0 1 1.313 7.814l-2.081.803a.704.704 0 0 0-.402.904l.684 1.774a9.429 9.429 0 0 1-1.142 1.17l-.685-.684c-.068-.068-.141-.05-.207.016l-.314.313c-.738.739-1.316.485-1.722.159-.389-.308-.587-.88-.423-1.14.949-1.361.853-1.948.74-2.915 1.095.246 2.42.314 3.26-.526.908-.907.857-2.1.714-2.804-.204-.987-.784-1.724-.961-1.901l-7.071-7.072a9.426 9.426 0 0 1 5.832 1.625l-.04 1.709a.694.694 0 0 0 .681.712l1.824.044Zm-11.707-3.688a.766.766 0 1 1-1.115 1.052.766.766 0 0 1 1.115-1.052Zm12.89 12.939a.766.766 0 1 1-1.115 1.051.766.766 0 0 1 1.115-1.051ZM73.187 22.723l.944.944-4.257 4.257-1.905-1.906a9.426 9.426 0 0 1 2.328-2.76l1.686.648c.36.137.765-.04.902-.4l.302-.783Zm3.894 3.985 2.249 2.248c.116.117.686.955.158 1.483-.437.437-1.134.054-1.578-.39l-2.086-2.087 1.257-1.254Zm-3.058 3.058 1.722 1.723c.157.157.796.886.14 1.978-.2.337-.924 1.362-1.101 1.745-.21.417-.422 1.46.022 1.904l2.812 2.811c-.441.064-.886.097-1.331.098l-.899-1.39a.7.7 0 0 0-.966-.207l-1.54.996a9.426 9.426 0 0 1-5.532-5.584l.997-1.54a.697.697 0 0 0-.206-.964l-1.36-.88c.007-.422.041-.843.104-1.26l5.447 5.445c.06.061.113.093.17.035l1.927-1.926c.055-.056.026-.11-.035-.17L72.8 30.984l1.223-1.219Zm-6.925 1.899a.766.766 0 1 1-1.113 1.05.766.766 0 0 1 1.113-1.05Zm7.996 8.044a.766.766 0 1 1-1.115 1.052.766.766 0 0 1 1.115-1.052Z"/><path fill="#000" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width=".739" d="M83.92 38.434A10.992 10.992 0 1 1 68.376 22.89 10.992 10.992 0 0 1 83.92 38.434Zm.605-.896.461 1.962-1.962-.461.067 2.015-1.833-.834-.326 1.99-1.639-1.179-.707 1.892-1.376-1.477-1.062 1.717-1.063-1.717-1.376 1.477-.707-1.892-1.639 1.18-.325-1.991-1.834.834.068-2.015-1.963.461.461-1.962-2.015.067.835-1.833-1.991-.326 1.179-1.64-1.892-.706 1.477-1.376-1.717-1.063 1.717-1.062-1.477-1.376 1.892-.707-1.18-1.639 1.992-.325-.835-1.834 2.015.067-.461-1.962 1.963.461-.068-2.015 1.834.834.325-1.99 1.64 1.179.706-1.892 1.376 1.477 1.063-1.717 1.062 1.717 1.376-1.477.707 1.892 1.639-1.18.326 1.991 1.834-.834-.068 2.015 1.962-.461-.461 1.962 2.015-.067-.834 1.834 1.99.325-1.179 1.64 1.892.706-1.477 1.376 1.717 1.063-1.717 1.062 1.477 1.376-1.892.707 1.18 1.639-1.991.326.834 1.833-2.015-.067Z" clip-rule="evenodd"/><path fill="#F74C00" d="M62.463 100.462s-13.965-9.33-16.978-29.599c0 0-34.006 24.677 15.008 48.328C67.5 114.5 65.5 111 62.463 100.462ZM337.103 111.155l6.395 2.345 3.8 4.786c45.163-26.767 23.513-55.309 23.513-55.309-4.352 24.034-19.194 29.189-19.194 29.189-2.619 7.834-7.619 8.834-7.619 8.834-3 1-6.895 10.155-6.895 10.155Z"/></g><defs><filter id="a" width="347.899" height="208" x="29.384" y="0" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset dx="-2" dy="1"/><feGaussianBlur stdDeviation="1"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/><feBlend in2="BackgroundImageFix" result="effect1_dropShadow_12_180"/><feBlend in="SourceGraphic" in2="effect1_dropShadow_12_180" result="shape"/></filter></defs></svg> + <h1>Copenhagen <span>Rust</span> Community</h1> + </a> </header> - {% endblock header %} + <nav> + <ul> + {% for item in config.extra.nav %} + <li> + <a href="{{ item.url | safe }}"> + {% if item.icon %}{{ item.icon | safe }}{% endif %}{{ item.title }} + </a> + </li> + {%- endfor %} + </ul> + </nav> - <main {% if page %}class="page-{{page.slug}}"{% endif %} {% if section %}class="section-{{section.title | lower}}"{% endif %}> - {% block sidebar %} - {% endblock sidebar %} - <div class="content"> - {% block content %} - {% endblock content %} - </div> + <main {% if page %}class="page-{{page.slug}}"{% endif %} {% if section %}class="page-{{section.title | lower}}"{% endif %}> + {% block content %} + {% endblock content %} </main> - - <footer> - <small>Last updated: {{ now()| date(format="%e %B at %H:%M", timezone="Europe/Berlin") }}</small> - </footer> - - {% block script %} - {% endblock script %} + + {% block footer %} + {% endblock footer %} </body> </html> diff --git a/templates/event-page.html b/templates/event-page.html index 44911f7..51a7cf4 100644 --- a/templates/event-page.html +++ b/templates/event-page.html @@ -3,9 +3,7 @@ {% block content %} <article> - <h1 class="title"> - {{ page.title }} - </h1> + <h1>{{ page.title }}</h1> {% set meetups = load_data(path="events.toml") %} {% set upcoming = meetups['upcoming'] %} @@ -14,14 +12,14 @@ {% set event = all_events | filter(attribute="title", value=page.title) | first %} {% if event %} - <details> - <summary> - <h3>Details about this event</h3> - </summary> - <div> - {{ macros::event_attributes(event=event) }} - </div> - </details> + <details> + <summary> + <h3>Details about this event</h3> + </summary> + <div> + {{ macros::event_attributes(event=event) }} + </div> + </details> {% else %} No data found for this event. {% endif %} diff --git a/templates/events.html b/templates/events.html index 6a34d22..3fefc7a 100644 --- a/templates/events.html +++ b/templates/events.html @@ -1,27 +1,8 @@ {% extends "base.html" %} {% import "macros.html" as macros %} -{% block sidebar %} -{% set toc = ['upcoming', 'recent', 'past'] %} -<aside class="toc"> - {% if section.toc %}{% set toc = section.toc %}{% elif page.toc %}{% set toc = page.toc %}{% endif %} - {% if toc %} - <div class="toc-sticky"> - <div class="toc-item"> - <a href="#events">Events</a> - </div> - {% for h in toc %} - <div class="toc-item-child"> - <a href="#{{h}}">{{ h | capitalize }}</a> - </div> - {% endfor %} - </div> - {% endif %} -</aside> -{% endblock sidebar %} - {% block content %} -<h1 class="title"> +<h1> {{ section.title }} </h1> @@ -64,5 +45,8 @@ {% endif %} {% endfor %} +{% endblock content %} -{% endblock content %}
\ No newline at end of file +{% block footer %} + {{ macros::last_update() }} +{% endblock footer %}
\ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 5822323..4e66f89 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,50 +1,43 @@ {% extends "base.html" %} +{% import "macros.html" as macros %} -{% block sidebar %} - <aside class="menu"> - {% set events = load_data(path="events.toml") %} - - {%- set nextEvent = events.upcoming | last %} - {%- if nextEvent -%} - <h2>Next event</h2> - - {% if nextEvent.url %} - <a class="title" href="{{ nextEvent.url }}">{{ nextEvent.title }}</a> - {% else %} - <span class="title">{{ nextEvent.title }}</span> - {% endif -%} - {% if nextEvent.date %} - <time datetime="{{ nextEvent.date }}">{{ nextEvent.date | date(format="%A, %e %B at %H:%M", timezone="Europe/Berlin") }}</time> - {% else %} - <div>(No date announced)</div> - {% endif -%} - {%- if not nextEvent.url -%}<div>(Link coming soon)</div>{%- endif -%} - {% endif %} +{% block content %} +<aside> + <h2>Updates</h2> + {% set events = load_data(path="events.toml") %} + + {%- set nextEvent = events.upcoming | last %} + {%- if nextEvent -%} + <p> + Next event: + <a href="/events">{{ nextEvent.title }}</a> - {%- set recentEvent = events.recent | first %} - {%- if recentEvent -%} - <h2>Recent event</h2> - - {% if recentEvent.url %} - <a class="title" href="{{ recentEvent.url }}">{{ recentEvent.title }}</a> - {% else %} - <span class="title">{{ recentEvent.title }}</span> - {% endif -%} - {% if recentEvent.date %} - <time datetime="{{ recentEvent.date }}">{{ recentEvent.date | date(format="%A, %e %B", timezone="Europe/Berlin") }}</time> - {% else %} - <div>(No date found)</div> - {% endif -%} - {%- if not recentEvent.url -%}<div>(No link found)</div>{%- endif -%} - {% endif %} - - <h2>Links</h2> - {% for menu in config.extra.menu %} - <a class="button" {% if menu.url %}href="{{ menu.url | safe }}"{% endif %}>{{ menu.title }}</a> - {%- endfor %} - </aside> -{% endblock sidebar %} + {% if nextEvent.date %} + <time datetime="{{ nextEvent.date }}">{{ nextEvent.date | date(format="%A, %e %B", timezone="Europe/Berlin") }}</time> + {% else %} + <i>To be announced</i> + {% endif -%} + </p> + {% endif %} -{% block content %} -{{ section.content | safe }} -{% endblock content %}
\ No newline at end of file + {%- set recentEvent = events.recent | first %} + {%- if recentEvent -%} + <p> + Recent event: + <a href="/events">{{ recentEvent.title }}</a> + + {% if recentEvent.date %} + <time datetime="{{ recentEvent.date }}">{{ recentEvent.date | date(format="%A, %e %B", timezone="Europe/Berlin") }}</time> + {% endif -%} + </p> + {% endif %} +</aside> + +<article> + {{ section.content | safe }} +</article> +{% endblock content %} + +{% block footer %} + {{ macros::last_update() }} +{% endblock footer %}
\ No newline at end of file diff --git a/templates/macros.html b/templates/macros.html index 7e5acb1..0ccadc1 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,37 +1,33 @@ {% macro event_attributes(event) %} <dl> - {% if event.url %} - <dt> - Signup - </dt> - <dd> - <a href="{{ event.url }}">{{ event.title}} on Meetup.com</a> - </dd> - {% endif %} - - <dt> - Date - </dt> + <dt>Date</dt> <dd> {% if event.date %} - <time datetime="{{ event.date }}">{{ event.date | date(format="%A, %e %B %Y", timezone="Europe/Berlin") }}</time> + <time datetime="{{ event.date }}">{{ event.date | date(format="%A, %e %B %Y at %R", timezone="Europe/Berlin") }}</time> {% else %} - (No date found) + <i>To be announced</i> {% endif %} </dd> - <dt> - Venue - </dt> + <dt>Venue</dt> <dd> {% if event.venue %} {{ event.venue }} – {% endif %} {% if event.address %}{{ event.address }} {% else %} - (No venue) + <i>To be announced</i> {% endif %} </dd> + <dt>Signup</dt> + <dd> + {% if event.url %} + <a href="{{ event.url }}">{{ event.title}} on Meetup.com</a> + {% else %} + <i>To be announced</i> + {% endif %} + </dd> + {% if event.content -%} <dt>Description</dt> <dd> @@ -39,4 +35,10 @@ </dd> {% endif %} </dl> -{% endmacro event_attributes %}
\ No newline at end of file +{% endmacro event_attributes %} + +{% macro last_update() %} +<footer> + <small>Last updated: {{ now()| date(format="%e %B at %H:%M", timezone="Europe/Berlin") }}</small> +</footer> +{% endmacro last_update %}
\ No newline at end of file diff --git a/templates/page.html b/templates/page.html index 6e097b8..a5e3d6f 100644 --- a/templates/page.html +++ b/templates/page.html @@ -2,51 +2,7 @@ {% block title %}{{ page.title }} | {{ super() }} {% endblock title %} -{% block sidebar %} -<aside class="toc"> - {% if section.toc %}{% set toc = section.toc %}{% elif page.toc %}{% set toc = page.toc %}{% endif %} - {% if toc %} - <div class="toc-sticky"> - {% for h in toc %} - <div class="toc-item"> - <a href="{{h.permalink | safe}}">{{ h.title }}</a> - </div> - {% if h.children %} - {% for h2 in h.children %} - <div class="toc-item-child"> - <a href="{{h2.permalink | safe}}">{{ h2.title }}</a> - </div> - {% endfor %} - {% endif %} - {% endfor %} - </div> - {% endif %} -</aside> -{% endblock sidebar %} - {% block content %} <h1>{{ page.title }}</h1> {{ page.content | safe }} -{% endblock content %} - -{% block script %} -<script> - const scrollHandler = entries => { - let entry = entries.find(entry => { return entry.isIntersecting && entry.intersectionRatio > 0.9; }); - if (!entry) return; - - document.querySelectorAll(".toc a").forEach((item) => { - item.classList.remove("active"); - }); - - let link = document.querySelector(`.toc a[href$="${decodeURIComponent(`#${entry.target.id}`)}"]`) - if (link) { - link.classList.add("active"); - link.scrollIntoView({ behavior: "auto", block: "nearest" }); - } - }; - const observer = new IntersectionObserver(scrollHandler, { threshold: 1 }); - let items = document.querySelectorAll('h1,h2,h3,h4,h5,h6'); - items.forEach(item => observer.observe(item)); -</script> -{% endblock script %}
\ No newline at end of file +{% endblock content %}
\ No newline at end of file |