jorge init

Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
Gwenhael Le Moine 2024-03-09 11:39:49 +01:00
commit c1af1ac8b5
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
15 changed files with 565 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
target
.DS_Store

4
README.md Normal file
View file

@ -0,0 +1,4 @@
# Mèo Lười
A jorge blog by Mèo Lười.

3
config.yml Normal file
View file

@ -0,0 +1,3 @@
name: "Mèo Lười"
author: "Mèo Lười"
url: "https://luoi.eu"

11
includes/nav.html Normal file
View file

@ -0,0 +1,11 @@
<nav>
<a href="/">{{ site.config.name }}</a>
<a href="/blog/">blog</a>
<div class="nav-right hidden-mobile">
{% assign sections = page.submenu %}
{% for section in sections %}
<a href="{{section[1]}}">{{section[0]}}</a>
{% endfor %}
</div>
</nav>

View file

@ -0,0 +1,14 @@
<article class="post">
<span class="date">{{ post.date | date: "%Y-%m-%d" }}</span>
<div>
<a class="title" href="{{ post.url }}">{{ post.title }}</a>
<small>
{% if post.favorite %} <a href="/blog/tags#⭐" style="text-decoration:none"></a> {% endif %}
<span class="tags hidden-mobile">
{% for tag in post.tags %}
<a href="/blog/tags#{{tag}}">#{{tag}}</a>
{% endfor %}
</span>
</small>
</div>
</article>

53
layouts/base.html Normal file
View file

@ -0,0 +1,53 @@
---
---
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
{% if page.title %}
<title>{{page.head_title|default: page.title }} | {{ site.config.name }}</title>
{% else %}
<title>{{ site.config.name }}</title>
{% endif %}
<link type="application/atom+xml" rel="alternate" href="/feed.xml" title="{{ site.config.name }}"/>
<link rel="stylesheet" href="/assets/css/main.css">
<meta name="author" content="{{site.config.author}}">
<meta property="og:article:author" content="{{ site.config.author }}">
<meta property="og:site_name" content="{{ site.config.name }}">
{% if page.title %}
<meta property="og:title" content="{{ page.title|default: site.config.name }}">
<meta name="twitter:title" content="{{ page.title|default: site.config.name }}">
{% endif %}
{% if page.excerpt or site.config.description %}
<meta name="description" content="{{ page.excerpt | default:site.config.description }}">
<meta name="og:description" content="{{ page.excerpt | default:site.config.description }}">
<meta name="twitter:description" content="{{ page.excerpt | default:site.config.description }}">
{% endif %}
{% if page.layout == "post" %}
<meta property="og:type" content="article">
<meta property="og:article:published_time" content="{{ page.date | date_to_xmlschema }}">
<meta property="og:url" content="{{ page.url | absolute_url }}">
<link rel="canonical" href="{{ page.url | absolute_url }}">
{% else %}
<meta property="og:type" content="website">
<meta property="og:url" content="{{ page.url | absolute_url }}">
<link rel="canonical" href="{{ page.url | absolute_url }}">
{% endif %}
{% if page.image != "" %}
<meta property="og:image" content="{{ page.image | absolute_url }}">
<meta name="twitter:image" content="{{ page.image | absolute_url }}">
{% endif %}
</head>
<body>
<div class="content">
{{ content }}
</div>
</body>
</html>

11
layouts/default.html Normal file
View file

@ -0,0 +1,11 @@
---
layout: base
---
{% include nav.html %}
<div class="layout-{{ page.layout }}">
{% if page.title %}<h2>{{page.title}}</h2>{% endif %}
{{ content }}
<br/>
</div>
<p class="footer center-block">powered by <a href="https://jorge.olano.dev">jorge</a></p>

29
layouts/post.html Normal file
View file

@ -0,0 +1,29 @@
---
layout: base
---
{% include nav.html %}
<div class="layout-{{ page.layout }}" lang="{{ page.lang | default:site.config.lang | default:'en' }}">
<header {% if page.cover-img %}class="with-cover"{% endif %}>
<h1 class="title">{{ page.title }}</h1>
{% if page.subtitle %}<h3 class="subtitle">{{ page.subtitle }}</h3>{% endif %}
{% if page.cover-img %}
<img class="cover-img" src="{{ page.cover-img | absolute_url }}">
{% endif %}
</header>
{{ content }}
</div>
<br/>
<br/>
<p class="center-block footer">
<span class="date">{{ page.date | date: "%d/%m/%Y" }}</span>
<span class="tags">
{% for tag in page.tags %}
<a href="/blog/tags#{{tag}}">#{{tag}}</a>
{% endfor %}
</span>
<br/>
powered by <a href="https://jorge.olano.dev">jorge</a>
</p>

291
src/assets/css/main.css Normal file
View file

@ -0,0 +1,291 @@
html {
color-scheme: light dark;
overflow-y: scroll;
}
body {
max-width: 45em;
margin: 0 auto;
padding: 0 1rem;
width: auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
line-height: 1.5;
height: 100vh;
display: flex;
flex-direction: column;
}
.content {
/* https://stackoverflow.com/a/38347131/993769 */
text-size-adjust: none;
-ms-text-size-adjust: none;
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
}
.footer {
padding: 2rem 0 1rem;
margin-top: auto;
}
@media screen and (max-width: 480px) {
.hidden-mobile {
display: none
}
}
nav {
margin: 1rem 0;
line-height: 1.8;
border-bottom: 1px solid;
display: flex;
}
.nav-right {
margin-left: auto;
}
nav a:not(:last-child) {
margin-right: 1rem
}
nav a:hover {
text-decoration: none;
}
li {
line-height: 1.6;
}
li:not(:last-child) {
padding-bottom: .75rem;
}
a, a:visited {
color: LinkText;
text-decoration: none;
}
a:hover {
text-decoration: underline
}
a.title {
color: black;
padding-right: .25rem;
}
@media (prefers-color-scheme: dark) {
a.title {
color: white;
}
}
.footer, .footer a, .date, .tags, .tags a {
color: silver;
}
.date {
padding-right: .5rem;
white-space: nowrap;
}
.tags {
display: inline-block;
}
article.post {
display: flex;
padding-bottom: .5rem;
}
.center-block {
text-align: center;
}
hr {
border: 0;
border-top:1px solid lightgray;
}
/* tweaks for post content style */
.layout-post img {
max-width: 75%;
max-height: 400px;
}
img.cover-img {
width: 100%;
max-width: 100%;
max-height: 200px;
object-fit: cover;
margin-bottom: -2rem;
}
.layout-post {
hyphens: auto;
text-align: justify;
font-size: 1.1rem;
line-height: 1.6;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased !important;
-moz-font-smoothing: antialiased !important;
text-rendering: optimizelegibility !important;
letter-spacing: .03em;
}
.layout-post .title {
hyphens:none;
}
.layout-post header {
margin: 3rem 0 5rem;
text-align: left;
}
.layout-post header.with-cover {
margin-top: -0.5rem;
}
pre {
font-size: 1rem;
overflow-x: auto;
line-height: 1.5;
padding: 1rem;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
/* Hide scrollbar for Chrome, Safari and Opera */
.src pre::-webkit-scrollbar {
display: none;
}
/* There are several code rendering scenarios that need to be handled reasonably:
- light vs dark preferred color scheme
- pre code blocks vs inline code spans
- language set vs no language set
- markdown vs org rendering
Need to decide between:
- fixing the color scheme of the page + using one of chroma's themes
- supporting both light/dark and disabling syntax highlighting altogether
- supporting light/dark, picking a theme and patching it to render decently
with both preferences (as done below, assuming chroma's github theme)
*/
.layout-post :not(pre) > code {
padding: .2em .4em;
background-color: whitesmoke!important;
color: black;
font-size: 1rem;
}
@media (prefers-color-scheme: dark) {
.layout-post :not(pre) > code {
background-color: rgba(110, 118, 129, 0.4)!important;
color: white;
}
}
.layout-post pre, .layout-post code {
border-radius: 6px;
background-color: whitesmoke!important;
font-size: 0.9rem;
hyphens: none;
color: black;
}
blockquote {
border-left: 2px solid whitesmoke;
padding-left: 1rem;
}
.layout-post p.verse {
text-align: right;
}
.layout-post p {
line-height: 1.8;
margin-bottom: 1.5rem;
}
.layout-post p + h2 {
padding-top: 1.5rem;
}
.layout-post .center-block {
margin: 2rem 0;
}
/* override in mobile devices for more compact text */
@media screen and (max-width: 768px) {
.layout-post {
line-height: 1.2;
letter-spacing: unset;
hyphens: none;
text-align: left;
}
.layout-post p {
margin: 1rem 0;
line-height: 1.7;
}
.layout-post p + p {
text-indent: 0;
}
.layout-post img {
max-width: 100%;
}
}
table {
width: 100%;
border-collapse: collapse;
font-size: 1.05rem;
}
table tr {
border-bottom: 1px solid #ddd;
}
@media screen and (max-width: 480px) {
td { display: inline-block }
}
td, th {
padding: .5rem;
}
hr.footnotes-separatator {
display:none;
}
/* makes footnote number and text display in the same line */
.footnote-definition {
display: block;
vertical-align: top;
margin-bottom: .4rem;
}
.footnote-body, .footnote-body p {
display: inline;
}
/* These control the expand/collapse behavior of the tags page */
details summary {
list-style: none;
cursor: pointer;
}
details summary h3::after {
content: "[+]";
font-size: small;
font-weight: normal;
font-family: monospace;
vertical-align: middle;
}
details[open] summary h3::after {
content: "[-]"
}
details > summary::-webkit-details-marker {
display: none;
}

View file

@ -0,0 +1,25 @@
---
title: Goodbye Markdown...
tags: [blog]
date: 2024-02-16
layout: post
---
## For the record
For the record, even though it has *org* in the name, jorge can also render markdown,
thanks to [goldmark](https://github.com/yuin/goldmark/).
Let's look at some code:
``` python
import os
def hello():
print("Hello World!")
os.exit(0)
hello()
```
[Next time](./hello-org), I'll talk about org-mode posts.

34
src/blog/hello-org.org Normal file
View file

@ -0,0 +1,34 @@
---
title: Hello Org!
subtitle: Writing posts with org-mode syntax
tags: [blog, emacs]
date: 2024-02-17
layout: post
---
#+OPTIONS: toc:nil num:nil
** Indeed
This post was originally written with org-mode syntax, instead of [[file:goodbye-markdown][markdown]].
As you can see, /italics/ and *bold* render as expected, and you can even use footnotes[fn:1].
All of this is powered by [[https://github.com/niklasfasching/go-org][go-org]], btw[fn:2].
Let's look at some code:
#+begin_src python
import os
def hello():
print("Hello World!")
os.exit(0)
hello()
#+end_src
** Notes
[fn:1] See?
[fn:2] And another one footnote, to stay on the safe side.

15
src/blog/index.html Normal file
View file

@ -0,0 +1,15 @@
---
layout: default
submenu: [["/feed", "/feed.xml"], ["/tags", "/blog/tags"]]
title: Blog
---
{% assign posts_by_year = site.posts | group_by_exp:"post", "post.date | date: '%Y'" %}
{% for year in posts_by_year %}
{% unless forloop.first%}
<br/>
{% endunless %}
{% for post in year.items %}
{% include post_preview.html %}
{% endfor %}
{% endfor %}

16
src/blog/tags.html Normal file
View file

@ -0,0 +1,16 @@
---
layout: default
title: Tags
---
{% for tag in site.tags %}
<details>
<summary>
<h3><a href="#{{tag[0]}}" class="title" id="{{tag[0]}}">#{{tag[0]}}</a></h3>
</summary>
{% for post in tag[1] %}
{% include post_preview.html %}
{% endfor %}
</details>
{% endfor %}

35
src/feed.xml Normal file
View file

@ -0,0 +1,35 @@
---
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" {% if site.config.lang %}xml:lang="{{ site.lang }}"{% endif %}>
<generator uri="https://jorge.olano.dev/" version="0.0.1">jorge</generator>
<link href="{{ page.url | absolute_url}}" rel="self" type="application/atom+xml"/>
<link href="{{ site.config.url }}" rel="alternate" type="text/html"/>
<updated>{{ "now" | date: "%Y-%m-%d %H:%M" }}</updated>
<id>{{ page.url | absolute_url}}</id>
<title type="html">{{ site.config.name }}</title>
<author>
<name>{{ site.config.author }}</name>
</author>
{% for post in site.posts limit:10 %}
<entry {% if post.lang %}xml:lang="{{post.lang}}"{% endif %}>
{% assign post_title = post.title | strip_html | normalize_whitespace | xml_escape %}
<title type="html">{{ post.title }}</title>
<link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post.title }}"/>
<published>{{ post.date | date: "%Y-%m-%d %H:%M" }}</published>
<updated>{{ post.date | date: "%Y-%m-%d %H:%M" }}</updated>
<id>{{ post.url | absolute_url }}</id>
<author>
<name>{{ post.author | default:site.config.author }}</name>
</author>
{% for tag in post.tags %}
<category term="{{ tag }}"/>
{% endfor %}
<summary type="html"><![CDATA[{{ post.excerpt | strip_html | normalize_whitespace }}]]></summary>
{% if post.image %}
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ post.image | absolute_url }}"/>
<media:content medium="image" url="{{ post.image | absolute_url }}" xmlns:media="http://search.yahoo.com/mrss/"/>
{% endif %}
</entry>
{% endfor %}
</feed>

21
src/index.html Normal file
View file

@ -0,0 +1,21 @@
---
layout: default
---
<h2><a href="#about" class="title" id="about">About</a></h2>
<p>Welcome to {{ site.config.name }} by {{ site.config.author }}.</p>
<br/>
<h2><a href="#latest" class="title" id="latest">Latest posts</a></h2>
{% for post in site.posts limit:3 %}
{% include post_preview.html %}
{% endfor %}
<p>See the full <a href="/blog">blog archive</a> or subscribe to the <a href="/feed.xml">feed</a>.</p>
<br/>
<h2><a href="#contact" class="title" id="contact">Contact</a></h2>
<ul>
<li><a href="mailto:some@email.com">@email</a></li>
<li><a href="https://some.site/profile">@somewhere else</a></li>
</ul>