Skip to content

Commit 666108f

Browse files
committed
Add Atom feed
1 parent a4358fc commit 666108f

File tree

15 files changed

+116
-3
lines changed

15 files changed

+116
-3
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ group :jekyll_plugins do
1414
gem 'jekyll-plantuml', '~> 1.4', '>= 1.4.2'
1515
gem 'jekyll-node-module', '~> 0.1.3'
1616
gem 'jekyll_picture_tag', '~> 2.1'
17+
gem 'jekyll-inline-svg', '~> 1.1', '>= 1.1.5'
1718
end
1819

1920
# Tests

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ GEM
4747
safe_yaml (~> 1.0)
4848
terminal-table (>= 1.8, < 4.0)
4949
webrick (~> 1.7)
50+
jekyll-inline-svg (1.1.5)
51+
jekyll (>= 3.3, < 5.0)
52+
svg_optimizer (~> 0.3.0)
5053
jekyll-node-module (0.1.3)
5154
jekyll (>= 2.0, < 5.0)
5255
jekyll-plantuml (1.4.2)
@@ -121,6 +124,8 @@ GEM
121124
safe_yaml (1.0.5)
122125
sass-embedded (1.78.0-x86_64-linux-gnu)
123126
google-protobuf (~> 4.27)
127+
svg_optimizer (0.3.0)
128+
nokogiri
124129
temple (0.10.3)
125130
terminal-table (3.0.2)
126131
unicode-display_width (>= 1.1.1, < 3)
@@ -134,6 +139,7 @@ PLATFORMS
134139

135140
DEPENDENCIES
136141
jekyll (~> 4.3, >= 4.3.3)
142+
jekyll-inline-svg (~> 1.1, >= 1.1.5)
137143
jekyll-node-module (~> 0.1.3)
138144
jekyll-plantuml (~> 1.4, >= 1.4.2)
139145
jekyll-postcss (~> 0.5.0)

_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ plugins:
1616
- jekyll-plantuml
1717
- jekyll-postcss
1818
- jekyll-node-module
19+
- jekyll-inline-svg
20+
21+
svg:
22+
optimize: true
1923

2024
node_modules:
2125
copy:

_data/i18n.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ home:
2323
en: New projects
2424
ru: Новые проекты
2525
tt: Яңа проектлар
26+
subscribe-posts:
27+
en: Subscribe to the posts feed!
28+
ru: Подпишись на ленту постов!
29+
tt: Язма каналына языл!
2630

2731
about:
2832
links-and-contacts:

_includes/post_card.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<a
44
href="{{ include.post.url | relative_url }}"
55
title="{{ include.post.title }}"
6-
class="vlink no-underline"
6+
class="vlink no-underline hover:underline"
77
>
88
{{ include.post.title | escape }}
99
</a>

_layouts/bare.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<link rel="alternate" hreflang="{{ lang }}" href="{{ page.url | absolute_url }}" />
2020
{% endfor %}
2121

22+
{% assign feed_posts_multilang = site.pages | where: "ref", "feed-posts-multilang" | first %}
23+
{% assign feed_posts = site.pages | where: "ref", "feed-posts" | where: "lang", page.lang | first %}
24+
<link rel="alternate" type="application/atom+xml" href="{{ feed_posts.url | absolute_url }}" title="{{ feed_posts.title }}"/>
25+
<link rel="alternate" type="application/atom+xml" href="{{ feed_posts_multilang.url | absolute_url }}" title="{{ feed_posts_multilang.title }}"/>
26+
2227
{% seo %}
2328
<meta name="viewport" content="width=device-width, initial-scale=1">
2429
<meta name="theme-color" content="#157878">

_layouts/blog_home.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
<div class="prose">
66
<h1>{{ site.data.i18n.blog.posts[page.lang] }}</h1>
7-
<span></span>
87
</div>
98

9+
{% assign feed_posts = site.pages | where: "ref", "feed-posts" | where: "lang", page.lang | first %}
10+
<a href="{{ feed_posts.url | absolute_url }}" class="inline-block vlink no-underline my-4">
11+
{% svg feed-icon.svg class="inline h-4 w-4"%}
12+
<span class="underline">{{ site.data.i18n.home.subscribe-posts | t }}</span>
13+
</a>
14+
1015
{% include posts.html limit=nil hlevel=2 %}

_layouts/feed.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
layout: none
3+
---
4+
<?xml version="1.0" encoding="utf-8"?>
5+
6+
<feed xmlns="http://www.w3.org/2005/Atom" {% if page.lang %}xml:lang="{{ page.lang }}"{% endif %}>
7+
<generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
8+
<title>{{ page.title | xml_escape }} | {{ site.title }}</title>
9+
<link href="{{ page.url | absolute_url }}" rel="self" type="application/atom+xml" />
10+
<link href="{{ site.url }}" />
11+
<id>{{ page.url | absolute_url | xml_escape }}</id>
12+
<updated>{{ site.time | date_to_xmlschema}}</updated>
13+
14+
{% assign posts = site.posts | sort: "date" | reverse %}
15+
{% if page.lang %}
16+
{% assign posts = posts | where: "lang", page.lang %}
17+
{% endif %}
18+
{% for post in posts limit: 10 %}
19+
<entry xml:lang="{{ post.lang }}">
20+
{% assign post_title = post.title | strip_html | normalize_whitespace | xml_escape %}
21+
<title>{{ post_title }}</title>
22+
<link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post_title }}"/>
23+
<published>{{ post.date | date_to_xmlschema }}</published>
24+
{% assign post_updated = post.last_modified_at | default: post.date %}
25+
<updated>{{ post_updated | date_to_xmlschema }}</updated>
26+
<id>{{ post.id | absolute_url | xml_escape }}</id>
27+
28+
<content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">
29+
<![CDATA[{{ post.content | strip }}]]>
30+
</content>
31+
<summary type="html">
32+
<![CDATA[{{ post.excerpt | strip_html | normalize_whitespace }}]]>
33+
</summary>
34+
<author>
35+
<name>{{ post.author.name }}</name>
36+
<uri>{{ post.author.url | xml_escape }}</uri>
37+
</author>
38+
</entry>
39+
{% endfor %}
40+
</feed>

_layouts/home.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ <h2 class="text-ghaze-600 text-center font-serif text-3xl font-semibold">
4747
{{ site.data.i18n.home.all-posts[page.lang] }}
4848
</a>
4949
</div>
50+
51+
{% assign feed_posts = site.pages | where: "ref", "feed-posts" | where: "lang", page.lang | first %}
52+
<a href="{{ feed_posts.url | absolute_url }}" class="inline-block vlink no-underline mt-4">
53+
{% svg feed-icon.svg class="inline h-4 w-4"%}
54+
<span class="underline">{{ site.data.i18n.home.subscribe-posts | t }}</span>
55+
</a>
5056
</section>
5157

5258
<section class="flex-1 min-w-[30ch]">

assets/css/main.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ object.plantuml {
1919
.vlink {
2020
@apply visited:text-[revert];
2121
@apply underline;
22-
@apply hover:underline;
2322
@apply text-clink;
2423
}
2524
}

0 commit comments

Comments
 (0)