We now have a calendar using Jekyll

This commit is contained in:
Nemo 2024-01-04 11:32:00 +05:30
parent 0dca103dcb
commit 6bf91150bd
10 changed files with 173 additions and 3 deletions

View File

@ -1,8 +1,12 @@
# Emoji Every Day
---
layout: default
title: Emoji Every Day
permalink: /about/
---
An emoji character for (almost) every day.
Data in emoji.yaml. Made for India, but can be extended to other countries.
Data in [`_data/emoji.yaml`](https://github.com/captn3m0/emoji-every-day/blob/main/_data/emoji.yml). Made for India, but can be extended to other countries.
Includes:
@ -33,4 +37,9 @@ the proposal isn't accepted yet.
Licensed under the [MIT License](https://nemo.mit-license.org/).
See LICENSE file for details.
## Why
Think of this as a poor man's Google Doodle for any website, where you might have daily refreshes. I'm currently using it for [news.tatooine.club](https://news.tatooine.club),
where I wanted to put a 🎄 next to the date for Christmas, but extended it to this project. See [Origin Post](https://tatooine.club/@nemo/111647981554186397) for more details.
[undays]: https://www.un.org/en/observances/list-days-weeks

6
_config.yml Normal file
View File

@ -0,0 +1,6 @@
url: "" # the base hostname & protocol for your site, e.g. http://example.com
baseurl: "" # the subpath of your site, e.g. /blog
title: "" # the name of your site, e.g. ACME Corp.
exclude:
- vendor
- test.py

View File

@ -324,7 +324,7 @@
link: https://www.wipo.int/ip-outreach/en/ipday/
type: UN
- day_name: International Girls in "Information and Communications Technology" Day
- day_name: International Girls in 'Information and Communications Technology' Day
emoji: 👩‍💻
link: https://www.itu.int/en/wgirls-ict/Pages/default.aspx
type: UN

11
_includes/emoji-date.html Normal file
View File

@ -0,0 +1,11 @@
{% assign emojis = site.data.emoji[include.date_key] | default: empty_array %}
{% if emojis.size > 0 %}
{% for event in emojis %}
{% if event.link %}
<a href="{{ event.link }}" title="{{ event.day_name }}">{{ event.emoji }}</a>
{% else %}
<span title="{{ event.day_name }}">{{ event.emoji }}</span>
{% endif %}
{% endfor %}
{% endif %}

4
_includes/footer.html Normal file
View File

@ -0,0 +1,4 @@
<footer>
<a href="/about">About</a> |
<a href="/">Calendar</a>
</footer>

31
_includes/year.html Normal file
View File

@ -0,0 +1,31 @@
{% assign current_date = site.time | date: "%m-%d" %}
{% assign epoch = 1704068700 %}
{% assign one_day = 60 | times: 60 | times: 24 %}
{% assign D = epoch %}
{% for date in (1...366) %}
{% assign D_n = D | date:"%d" %}
{% if D_n == "01" %}
{% assign month = D|date:"%m" %}
<div class="month">
<h2>{{D|date:"%B"}}</h2>
<div class="days">
{% endif %}
{% assign D_x = D|date:"%m-%d"%}
{% assign D_y = D|date:"%Y-%m-%d"%}
<div class=day class="day {% if D_x == current_date%}today{% endif %}">
{{D|date:"%d"}}
<div class=emojis>
{% include emoji-date.html date_key=D_x %}
{% include emoji-date.html date_key=D_y %}
</div>
</div>
{% assign D = D | plus:one_day %}
{% assign new_month = D|date:"%m" %}
{% if new_month != month %}
<!-- close the days and month divs -->
</div></div>
{% endif %}
{% endfor %}

16
_layouts/default.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<title>{{ page.title }} - {{ site.title }}</title>
<link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}">
</head>
<body>
<h1>{{page.title}}</h1>
<main>
{{ content }}
</main>
{% include footer.html %}
</body>
</html>

17
_sass/base.scss Normal file
View File

@ -0,0 +1,17 @@
$backgroundColor: #ffffff;
$bodyColor: #000000;
$bodyFont: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
body {
background: $backgroundColor;
color: $bodyColor;
font-family: $bodyFont;
}
footer {
margin-top: 20px;
padding: 20px;
text-align: center;
font-size: 0.8em;
color: #aaa;
}

69
assets/css/main.scss Normal file
View File

@ -0,0 +1,69 @@
---
---
@import "base";
$primary-color: #3498db;
$today-color: #e74c3c;
h1 {
color: $primary-color;
text-align: center;
}
.calendar {
display: flex;
flex-wrap: wrap;
margin: 20px;
font-family: Arial, sans-serif;
.month {
width: 100%; /* Full width on small screens */
margin: 10px;
padding: 10px;
box-sizing: border-box;
h2 {
color: $primary-color;
margin-bottom: 10px;
}
.days {
display: flex;
flex-wrap: wrap;
}
.day {
width: 14.28%; /* One-seventh of the container */
box-sizing: border-box;
padding: 10px;
border: 1px solid #ddd;
text-align: center;
&.today {
background-color: $today-color;
color: #fff;
font-weight: bold;
}
.emoji {
font-size: 1.2em;
}
a {
text-decoration: none;
color: inherit;
}
}
}
@media (min-width: 600px) {
.month {
width: 48%; /* Two months per row on medium screens */
}
}
@media (min-width: 768px) {
.month {
width: 31%; /* Three months per row on large screens */
}
}
}

7
index.md Normal file
View File

@ -0,0 +1,7 @@
---
layout: default
title: Emoji Calendar 2024
---
<div class="calendar">
{% include year.html %}
</div>