Skip to content

Pycon liquid to jinja #704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/teahouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish

on:
push:
workflow_dispatch:
repository_dispatch:

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

concurrency:
group: "teahouse"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ammaraskar/[email protected]
with:
pre-build-command: bundle
build-command:
docs-folder: "."
- uses: actions/upload-artifact@v4
with:
name: website
path: ./build

# Deployment job
deploy:
if: github.repository == 'teahouse-hosting/docs.teahouse.cafe' && github.ref == 'refs/heads/trunk'
environment:
name: teahouse
url: https://docs.teahouse.cafe
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: website
path: ./build
- name: Upload
uses: teahouse-hosting/upload@trunk
with:
domain: docs.teahouse.cafe
root: ./build/html
3 changes: 1 addition & 2 deletions _articles/es/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ <h3 class="pico-color-pumpkin-50">Amplíe su alcance</h3>
<p class="pico-color-pumpkin-50">Existen grandes programas. Nuestro objetivo es ayudar a que esos programas se conviertan en nuestras comunidades locales.</p>
<p><a class="contrast" href="/es/about/">Aprende Más</a></p>
</article>
<article class="pico-background-zinc-800"
">
<article class="pico-background-zinc-800">
<h3 class="pico-color-pumpkin-50">¡Dilo en voz alta!</h3>
<p class="pico-color-pumpkin-50">Nuestra pila y nuestras decisiones son de código abierto por defecto y compartimos lo que estamos haciendo de la forma más alta y frecuente posible.</p>
<p><a class="contrast" href="/es/about/">Aprende Más</a></p>
Expand Down
34 changes: 0 additions & 34 deletions _includes/latest-posts.html

This file was deleted.

7 changes: 0 additions & 7 deletions _includes/social-item.html

This file was deleted.

5 changes: 0 additions & 5 deletions _includes/social.html

This file was deleted.

File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions _includes/footer.html → _layouts/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ <h3>About us</h3>
<div class="footer-col">
<h3>Quick link</h3>
<ul>
<li><a href="/about/">About Us</a></li>
<li><a href="/event/">Events</a></li>
<li><a href="/about.html">About Us</a></li>
<li><a href="/events/">Events</a></li>
<li><a href="/community/">Community</a></li>
<li><a href="/support/">Support</a></li>
</ul>
Expand All @@ -22,11 +22,11 @@ <h3>Contact Us</h3>
<address>
<p>Email: <a href="mailto:[email protected]">[email protected] </a></p>
</address>
<nav>{%- include social.html -%}</nav>
<nav>{%- include "_includes/social.html" -%}</nav>
</div>
</div>
<div class="footer-bottom">
<small>&copy; {{ 'now' | date: "%Y" }} {{ site.domain }}</small>
<small>&copy; {{ 'now' }} {{ domain }}</small>
</div>
</div>
</footer>
30 changes: 15 additions & 15 deletions _includes/header.html → _layouts/_includes/header.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{% assign t = site.data.locales[page.lang][page.lang] %}
{% set t = locales %}
<header class="site-header" role="banner">
<h1 class="site-title"><a class="logo-text" href="/index.html"><img src="{{ 'assets/images/black_python_devs_logo-horizontal-white.png' | relative_url }}" alt="Black Python Devs" /></a></h1>
<h1 class="site-title"><a class="logo-text" href="/index.html"><img src="{{ 'assets/images/black_python_devs_logo-horizontal-white.png' }}" alt="Black Python Devs" /></a></h1>
<nav class="site-navigation" aria-label="Main navigation">
<div class="site-navigation-wrap">
<ul class="menu" role="menu">
{% for item in site.navigation %}
{% assign current = nil %}
{% assign nav_lang = nil %}
{% if page.url == item.url %}
{% assign current = 'nav-current' %}
{% for item in navigation %}
{% set current = nil %}
{% set nav_lang = nil %}
{% if url == item.url %}
{% set current = 'nav-current' %}
{% endif %}
{% if page.lang != 'en' %}
{% assign nav_lang = page.lang | prepend: '/' %}
{% if lang != 'en' %}
{% set nav_lang = lang %}
{% endif %}
<li class="menu-item {{ current }}" role="menuitem">
<a class="{{ current }}" href="{{ nav_lang }}{{ item.url }}"> <i class="{{ item.fa }}" aria-hidden="true"></i>&nbsp;{{ t.nav[forloop.index0] }} </a>
<a class="{{ current }}" href="{{ nav_lang }}{{ item.url }}"> <i class="{{ item.fa }}" aria-hidden="true"></i>&nbsp;{{ item.text }} </a>
</li>
{% endfor %}
{% if page.lang and site.data.locales.size > 1 %}
{% if locales | length > 1 %}
<li class="menu-item" role="menuitem">
<div class="">
<i class="fa fa-language" aria-hidden="true"></i>
<select id="language" class="form-select" aria-label="Language">
{% assign locales = site.data.locales | sort %}
{% set locales = locales | sort %}
{% for locale in locales %}
{% assign lang = locale[0] %}
{% assign locale_name = locale[1][lang].locale_name %}
{% if page.lang == lang %}
{% set lang = locale[0] %}
{% set locale_name = locale[1][lang].locale_name %}
{% if lang == lang %}
<option value="{{ lang }}" selected="selected">{{ locale_name }}</option>
{% else %}
<option value="{{ lang }}">{{ locale_name }}</option>
Expand Down
File renamed without changes.
43 changes: 43 additions & 0 deletions _layouts/_includes/latest-posts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

{% block content %}
{% for page in pages %}
{%- if page.list_title -%}
<h2 class="post-list-heading">{{ list_title }}</h2>
{% endif %}
<article class="post-list">
<div>
<h3>
<a class="" href="{{ url }}"> {{ title | escape }} </a>
</h3>
<p>{{ date }}</p>
{%- if site.show_excerpts -%}
<p class="post-description" style="margin-bottom: 2rem">{{ description}}</p>
</div>
</article>

<div class="pager">
<ul class="pagination">
{%- if paginator.previous_page %}
<li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous-page">{{ paginator.previous_page
}}</a></li>
{%- else %}
<li>
<div class="pager-edge">•</div>
</li>
{%- endif %}
<li>
<div class="current-page">{{ paginator.page }}</div>
</li>
{%- if paginator.next_page %}
<li><a href="{{ paginator.next_page_path | relative_url }}" class="next-page">{{ paginator.next_page }}</a></li>
{%- else %}
<li>
<div class="pager-edge">•</div>
</li>
{%- endif %}
</ul>
</div>
{%- endif %}

{% endfor %}
{% endblock %}
100 changes: 100 additions & 0 deletions _layouts/_includes/map.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!-- Load Leaflet CSS and JS from CDN -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.css"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"></script>

<style>
#map-container {
width: 100%;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}

#map {
height: 500px;
width: 100%;
border: 2px solid #ddd;
border-radius: 4px;
}

h1 {
color: #333;
text-align: center;
}

.instructions {
background-color: #f9f9f9;
padding: 15px;
border-radius: 4px;
margin-top: 20px;
}
</style>

<div id="map-container">
<h1>Interactive Map</h1>
<div id="map"></div>
<div class="instructions">
<p>
<strong>Instructions:</strong> You can drag to move the map, scroll to
zoom in/out, and click on the marker to see information.
</p>
</div>
</div>

<script>
// Global variables
let map;
let geojsonLayer = null;
const countryMap = new Map();
var country_count = {{count_by_country | tojson}}

// Initialize map once
function initMap() {
map = L.map(
"map", {
maxZoom: 5,
minZoom: 1
}
).setView([0, 0], 2);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(
map,
);


// Load GeoJSON once
fetch("/static/countries.geojson")
.then((response) => response.json())
.then((data) => {
geojsonLayer = L.geoJSON(data).addTo(map);
// Only update after geojsonLayer is defined
updateMapData();
});
}

// Update map data - check if geojsonLayer exists first
function updateMapData() {
if (!geojsonLayer) return; // Skip if geojsonLayer not loaded yet

console.log(country_count)
geojsonLayer.eachLayer((layer) => {
const countryName = layer.feature.properties.name;
const count = country_count[countryName] || 0;

// Update style
layer.setStyle({
color: "#3388ff",
weight: 1,
fillColor: "#ff0000",
fillOpacity: count > 0 ? Math.min(0.20 + count / 200, 0.9) : 0,
});

// Update popup
layer.bindPopup(`${countryName}: ${count}`);
});
}

initMap();
</script>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<article>
<h3>{{include.newsletter_title}}</h3>
<h3>{{newsletter_title}}</h3>
<form action="https://buttondown.email/api/emails/embed-subscribe/black-python-devs" method="post" target="popupwindow" onsubmit="window.open('https://buttondown.email/black-python-devs', 'popupwindow')">
<fieldset role="group">
<input type="email" name="email" id="bd-email" placeholder="Enter your email" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ <h2>Partnerships</h2>
<p>We're happy to share with you our proud sponsors who offer their products at discounted rates and a portion of proceeds go to support Black Python Devs!</p>

<div class="grid">
{% for partner in site.data.partnerships %}
{% for partner in partnerships %}
<article>
<div class="grid">
<div>
<img src="{{partner.logo}}" alt="{{partner.name}} Logo" style="max-height: 14em" />
<img src="{{logo}}" alt="{{name}} Logo" style="max-height: 14em" />
</div>
<div>
<h3><a href="{{partner.url}}">{{ partner.name }}</a></h3>
<p>{{ partner.description }}</p>
<a href="{{ partner.url }}">Learn more</a>
<h3><a href="{{url}}">{{ name }}</a></h3>
<p>{{ description }}</p>
<a href="{{ url }}">Learn more</a>
</div>
</div>
</article>
Expand Down
File renamed without changes.
File renamed without changes
7 changes: 7 additions & 0 deletions _layouts/_includes/social-item.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<li>
<a {% unless entry.platform="" ="rss" %}rel="me" {% endunless %}href="{{ entry.user_url }}" target="_blank" title="{{ entry.title | default: entry.platform }}">
<svg class="svg-icon grey">
<use xlink:href="/assets/minima-social-icons.svg#"></use>
</svg>
</a>
</li>
3 changes: 3 additions & 0 deletions _layouts/_includes/social.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ul class="social-media-list">
{%- for entry in social_links -%} {%- include "social-item.html" -%} {%- endfor -%}
</ul>
File renamed without changes.
Loading
Loading