Skip to content

Commit

Permalink
feat: add rss feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Airscript committed Aug 21, 2022
1 parent dd780ab commit 36c7e86
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 17 deletions.
39 changes: 27 additions & 12 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@ languageName = "it"
languageAltTitle = "Italiano"
contentDir = "content/italian"

description = """
Ti do il benvenuto su airscript.it!
Su questo blog troverai articoli relativi ad informatica, motivazione e molto altro!
"""

[languages.it.homeInfoParams]
Title = "Oh, ciao! 👋🏻"

Content = """
Ti do il benvenuto su **airscript.it**!
Su questo blog troverai articoli relativi ad informatica, motivazione e molto altro!
Se vuoi, puoi supportarmi attraverso i link sotto o lasciando una 🌟 al [blog su GitHub](https://github.com/Airscripts/blog.airscript.it).
 
Qui non si bada a spese!
*John Hammond, Jurassic Park.*
Ti do il benvenuto su **airscript.it**!
Su questo blog troverai articoli relativi ad informatica, motivazione e molto altro!
Se vuoi, puoi supportarmi attraverso i link sotto o lasciando una 🌟 al [blog su GitHub](https://github.com/Airscripts/blog.airscript.it).
 
Qui non si bada a spese!
*John Hammond, Jurassic Park.*
"""

# [[languages.it.menu.main]]
Expand All @@ -48,8 +53,14 @@ url = "search/"
[languages.en]
weight = 2
languageName = "en"
languageAltTitle = "English"
contentDir = "content/english"

description = """
I welcome you on airscript.it!
On this blog you'll find articles related to computer science, motivation and much more!
"""

# [[languages.en.menu.main]]
# weight = 5
# name = "Archive"
Expand All @@ -69,12 +80,12 @@ url = "search/"
Title = "Oh, hello! 👋🏻"

Content = """
I welcome you on **airscript.it**!
On this blog you'll find articles related to computer science, motivation and much more!
If you want, you can support me through the link below or leaving a 🌟 at my [blog on GitHub](https://github.com/Airscripts/blog.airscript.it).
 
Spared no expense!
*John Hammond, Jurassic Park.*
I welcome you on **airscript.it**!
On this blog you'll find articles related to computer science, motivation and much more!
If you want, you can support me through the link below or leaving a 🌟 at my [blog on GitHub](https://github.com/Airscripts/blog.airscript.it).
 
Spared no expense!
*John Hammond, Jurassic Park.*
"""


Expand Down Expand Up @@ -106,6 +117,10 @@ url = "https://github.com/sponsors/Airscripts"
name = "KoFi"
url = "https://ko-fi.com/airscript"

[[params.socialIcons]]
name = "RSS"
url = "https://blog.airscript.it/index.xml"

[params.editPost]
appendFilePath = false
Text = "Suggest Changes"
Expand Down
3 changes: 2 additions & 1 deletion content/english/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ layout: "about"
date: "2022-08-12"
author: "Airscript"
categories: ["general"]
images: "/logo-512x512"
tags: ["airscript", "about"]
summary: "Blog's about page."
summary: "Blog's about page where I tell about who I am, what I do and the objectives of the blog."
---
> To make something special, you just have to believe it's special.
> *Mr. Ping, Kung Fu Panda*
Expand Down
2 changes: 1 addition & 1 deletion content/english/archives.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Archive"
layout: "archives"
summary: "archives"
summary: "Archies of blog.airscript.it."
---
5 changes: 4 additions & 1 deletion content/english/offline.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
title: "You are offline"
type: "offline"
layout: "offline"
searchHidden: true
robotsNoIndex: true
title: "You are offline"
---
Looks like you're offline.
2 changes: 2 additions & 0 deletions content/english/search.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: "Search"
layout: "search"
summary: "Search something on blog.airscript.it!"
robotsNoIndex: true
---
2 changes: 1 addition & 1 deletion content/italian/archives.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Archivio"
layout: "archives"
summary: "archives"
summary: "Archivi di blog.airscript.it."
---
5 changes: 4 additions & 1 deletion content/italian/offline.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
title: "Sei offline"
type: "offline"
layout: "offline"
searchHidden: true
robotsNoIndex: true
title: "Sei offline"
---
Sembra tu sia offline.
2 changes: 2 additions & 0 deletions content/italian/search.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: "Cerca"
layout: "search"
summary: "Cerca qualcosa su blog.airscript.it!"
robotsNoIndex: true
---
50 changes: 50 additions & 0 deletions layouts/_default/rss.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ site.Title }}</description>
{{- with site.Params.images }}
<image>
<url>{{ index . 0 | absURL }}</url>
<link>{{ index . 0 | absURL }}</link>
</image>
{{- end }}
<generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with site.Author.email }}
<managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with site.Author.email }}
<webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
{{- if and (ne .Layout `search`) (ne .Layout `archives`) (ne .Layout `offline`) }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
{{- if site.Params.ShowFullTextinRSS }}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
{{- end }}
</item>
{{- end }}
{{ end }}
</channel>
</rss>

0 comments on commit 36c7e86

Please sign in to comment.