Fixing JSON feed
Build and copy to prod / build-and-copy (push) Successful in 2m13s

This commit is contained in:
Lewis Dale committed 2024-04-29 19:15:50 +01:00
1 parent defc675783
commit 5eab7bcb9d
7 files changed
+49 -7

No files matched your search

@@ -4,6 +4,7 @@ date: 2024-03-08T11:12:00Z
tags:
- eleventy
- tech
excerpt: "I decided to start using Robb Knight's Echo tool to syndicate my blog posts to Mastodon, and trigger Webmentions."
---
I decided to start using [Robb Knight's Echo tool](https://echo.rknight.me), to syndicate my blog posts to Mastodon, and trigger Webmentions. I'm not going to go through the configuration of Echo here, the [project README](https://github.com/rknightuk/echo) has some good instructions for setting it up.
+1
View File
@@ -4,6 +4,7 @@ description: My blog is going naked for CSS naked day
tags:
- css
date: 2024-04-09T07:11:20.550Z
excerpt: "It's CSS Naked Day, so to celebrate I've stripped all of the CSS from my blog."
---
It's [CSS Naked Day](https://css-naked-day.github.io/)[^1], so to celebrate I've stripped all of the CSS from my blog.
+4 -4
View File
@@ -1,11 +1,11 @@
---
title: "Learning Go: Day One"
date: 2024-05-01T09:00:00.0Z
date: 2024-05-01T08:00:00.0Z
tags:
- tech
- learning
- go
- weblogpomo
- WeblogPoMo
excerpt: "I've wanted to try learning Go for a while now, but have never got round to it. So I'm going to (attempt) to learn a little bit about it each day, and blog about it, with a view to building something with it by the end of the month."
---
@@ -125,7 +125,7 @@ func multiply(a, b int) int {
func main() {
fmt.Println(sayHello())
var num int = multiply(2, 5)
fmt.Println(fmt.Sprintf("2 * 5 = %d", num))
fmt.Printf("2 * 5 = %d\n", num)
}
```
@@ -135,7 +135,7 @@ func main() {
func main() {
fmt.Println(sayHello())
num := multiply(2, 5)
fmt.Println(fmt.Sprintf("2 * 5 = %d", num))
fmt.Printf("2 * 5 = %d\n", num)
}
```
@@ -0,0 +1,34 @@
---
title: ""Learning Go: Day Two"
date: 2024-05-02T08:00:00.0Z
tags:
- tech
- learning
- go
- WeblogPoMo
excerpt: "In part two, I take a look at how to organise code into packages"
---
Welcome to Part Two of my series on Learning Go for WeblogPoMo. In this part, I'm going to look at how to organise my code into separate packages, so that I don't have to store everything in once single file.
## Creating a package
This was fairly straightforward. Packages are noted by the `package <name>` directive at the start of the file. You can even see that in `main.go`, which has `package.main` at the start. So, to create a package I added a directory for it (I'm calling it `maths`[^1]), and then added a `maths.go` file to it. For now, I'll just move the `multiply` function to it:
```go
package maths
func multiply(a, b int) int {
return a * b
}
```
Fairly straightforward, right?
## Importing and running the code
## Wait, what?
## The vendor directory
[^1]: Yes, maths, not math
+3 -1
View File
@@ -26,7 +26,9 @@
"url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}",
"content_html": {% if post.templateContent %}{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | dateToRfc3339 }}"
"date_published": "{{ post.date | dateToRfc3339 }}",
"tags": {{ post.data.tags | except("posts") | json | safe }},
"summary": "{{ post | excerpt }}"
}
{% if not loop.last %},{% endif %}
{%- endfor %}
+3 -1
View File
@@ -28,7 +28,9 @@ eleventyImport:
"url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}",
"content_html": {% if post.templateContent %}{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | dateToRfc3339 }}"
"date_published": "{{ post.date | dateToRfc3339 }}",
"tags": {{ post.data.tags | except("posts") | json | safe }},
"summary": "{{ post | excerpt }}"
}
{% if not loop.last %},{% endif %}
{%- endfor %}