Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bluesky shortcode #1398

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
}

/*
! tailwindcss v3.4.15 | MIT License | https://tailwindcss.com
! tailwindcss v3.4.16 | MIT License | https://tailwindcss.com
*/

/*
Expand Down
14 changes: 14 additions & 0 deletions exampleSite/content/posts/tests/bluesky-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "Bluesky Tests"
date: 2024-12-14T23:35:20+00:00
lastmod: 2024-12-14T23:35:20+00:00
draft: true
description: "Bluesky Shortcode Tests"
categories: [Tests]
hiddenFromHomePage: true
hiddenFromSearch: true
---

<!--more-->

{{< bluesky link="https://bsky.app/profile/bsky.app/post/3latotljnec2h" >}}
Original file line number Diff line number Diff line change
Expand Up @@ -1598,3 +1598,23 @@ Without an explicitly given picture, a generic icon is used. This input:
```

This renders as {{< person "https://dillonzq.com/" Dillon "author of the LoveIt theme" >}}.

## bluesky

`bluesky` is a shortcode to embed a post from [Bluesky](https://bsky.app).

The `bluesky` shortcode has the following named parameters:

* **link** *[required]*

URL of the Bluesky post.

Example `bluesky` input:

```markdown
{{</* bluesky link="https://bsky.app/profile/bsky.app/post/3latotljnec2h" */>}}
```

The rendered output looks like this:

{{< bluesky link="https://bsky.app/profile/bsky.app/post/3latotljnec2h" >}}
Original file line number Diff line number Diff line change
Expand Up @@ -1600,4 +1600,22 @@ print("Hello world!")
{{</* person "https://dillonzq.com/" Dillon "author of the LoveIt theme" */>}}
```

呈现的输出效果为 {{< person "https://dillonzq.com/" Dillon "author of the LoveIt theme" >}}.
呈现的输出效果为 {{< person "https://dillonzq.com/" Dillon "author of the LoveIt theme" >}}.

## bluesky

`bluesky` shortcode 用于嵌入 [Bluesky](https://bsky.app) 的帖子。

`bluesky` shortcode 有以下命名参数:

* **link** *[必需]*

Bluesky 帖子的 URL。

一个 `bluesky` 示例:

```markdown
{{</* bluesky link="https://bsky.app/profile/bsky.app/post/3latotljnec2h" */>}}
```

呈现的输出效果为 {{< bluesky link="https://bsky.app/profile/bsky.app/post/3latotljnec2h" >}}
8 changes: 8 additions & 0 deletions layouts/shortcodes/bluesky.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- $link := .Get "link" -}}
{{- $query := querify "url" $link -}}
{{- $request := printf "https://embed.bsky.app/oembed?%s" $query -}}

{{- $jsonOembed := resources.GetRemote $request -}}
{{- $jsonOembed = $jsonOembed | transform.Unmarshal -}}
{{- $jsonOHTML := $jsonOembed.html -}}
{{- $jsonOHTML | safeHTML -}}
Loading