Fixing JSON feed
All checks were successful
Build and copy to prod / build-and-copy (push) Successful in 2m13s
All checks were successful
Build and copy to prod / build-and-copy (push) Successful in 2m13s
This commit is contained in:
parent
defc675783
commit
5eab7bcb9d
@ -1,5 +1,7 @@
|
|||||||
const createExcerpt = (post, limit ) => {
|
const createExcerpt = (post, limit ) => {
|
||||||
const withoutTags = post.content.replace(/(<([^>]+)>)/gi, "");
|
const withoutTags = post.content.replace(/(<([^>]+)>)/gi, "")
|
||||||
|
.replace(/[^\x20-\x7E]/gmi, " ")
|
||||||
|
.replace(/\s+/g, " ").trim();
|
||||||
|
|
||||||
if (withoutTags.length > limit) {
|
if (withoutTags.length > limit) {
|
||||||
return withoutTags.slice(0, limit) + " […]";
|
return withoutTags.slice(0, limit) + " […]";
|
||||||
|
@ -4,6 +4,7 @@ date: 2024-03-08T11:12:00Z
|
|||||||
tags:
|
tags:
|
||||||
- eleventy
|
- eleventy
|
||||||
- tech
|
- 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.
|
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.
|
||||||
|
@ -4,6 +4,7 @@ description: My blog is going naked for CSS naked day
|
|||||||
tags:
|
tags:
|
||||||
- css
|
- css
|
||||||
date: 2024-04-09T07:11:20.550Z
|
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.
|
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.
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: "Learning Go: Day One"
|
title: "Learning Go: Day One"
|
||||||
date: 2024-05-01T09:00:00.0Z
|
date: 2024-05-01T08:00:00.0Z
|
||||||
tags:
|
tags:
|
||||||
- tech
|
- tech
|
||||||
- learning
|
- learning
|
||||||
- go
|
- 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."
|
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() {
|
func main() {
|
||||||
fmt.Println(sayHello())
|
fmt.Println(sayHello())
|
||||||
var num int = multiply(2, 5)
|
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() {
|
func main() {
|
||||||
fmt.Println(sayHello())
|
fmt.Println(sayHello())
|
||||||
num := multiply(2, 5)
|
num := multiply(2, 5)
|
||||||
fmt.Println(fmt.Sprintf("2 * 5 = %d", num))
|
fmt.Printf("2 * 5 = %d\n", num)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
34
src/blog/posts/2024/5/learning-go-day-2.md
Normal file
34
src/blog/posts/2024/5/learning-go-day-2.md
Normal file
@ -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
|
@ -26,7 +26,9 @@
|
|||||||
"url": "{{ absolutePostUrl }}",
|
"url": "{{ absolutePostUrl }}",
|
||||||
"title": "{{ post.data.title }}",
|
"title": "{{ post.data.title }}",
|
||||||
"content_html": {% if post.templateContent %}{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}{% else %}""{% endif %},
|
"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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -28,7 +28,9 @@ eleventyImport:
|
|||||||
"url": "{{ absolutePostUrl }}",
|
"url": "{{ absolutePostUrl }}",
|
||||||
"title": "{{ post.data.title }}",
|
"title": "{{ post.data.title }}",
|
||||||
"content_html": {% if post.templateContent %}{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}{% else %}""{% endif %},
|
"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 %}
|
{% if not loop.last %},{% endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user