mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
perf: add bluesky shortcode with remote JSON retrieval and styling
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
.bluesky-embed {
|
||||||
|
margin: 1rem auto;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
@import '_admonition';
|
@import '_admonition';
|
||||||
@import '_bilibili';
|
@import '_bilibili';
|
||||||
|
@import '_bluesky';
|
||||||
@import '_douyin';
|
@import '_douyin';
|
||||||
@import '_cardlink';
|
@import '_cardlink';
|
||||||
@import '_center-quote';
|
@import '_center-quote';
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
{{- $response := dict -}}
|
{{- $response := dict -}}
|
||||||
{{- with try (resources.GetRemote .URL .OPTIONS) -}}
|
{{- $url := .URL -}}
|
||||||
{{- with .Err -}}
|
{{- $options := .OPTIONS | default dict -}}
|
||||||
{{- erroridf "error-get-remote-json" "%s" . -}}
|
|
||||||
{{- else with .Value -}}
|
{{- if $url -}}
|
||||||
{{- $response = .Content | transform.Unmarshal -}}
|
{{- $cacheKey := print $url (now.Format "2006-01-02") -}}
|
||||||
{{- else -}}
|
{{- $options = $options | merge (dict "key" $cacheKey) -}}
|
||||||
{{- erroridf "error-get-remote-json" "Unable to get remote resource %q" $.URL -}}
|
{{- with try (resources.GetRemote $url $options) -}}
|
||||||
|
{{- with .Err -}}
|
||||||
|
{{- erroridf "error-get-remote-json" "%s" . -}}
|
||||||
|
{{- else with .Value -}}
|
||||||
|
{{- $response = .Content | transform.Unmarshal -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- erroridf "error-get-remote-json" "Failed to get remote JSON %q" $url -}}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- hugo.Store.Set "version" "v0.4.0-alpha.3-20251222094907-1bb21fcb" -}}
|
{{- hugo.Store.Set "version" "v0.4.0-alpha.3-20251223031039-a78c07f7" -}}
|
||||||
{{- .Store.Set "this" dict -}}
|
{{- .Store.Set "this" dict -}}
|
||||||
|
|
||||||
{{- partial "init/detection-env.html" . -}}
|
{{- partial "init/detection-env.html" . -}}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
{{- $link := .Get "link" -}}
|
{{- $link := .Get "link" -}}
|
||||||
{{- $query := querify "url" $link -}}
|
{{- $query := querify "url" $link -}}
|
||||||
{{- $request := printf "https://embed.bsky.app/oembed?%s" $query -}}
|
{{- $request := printf "https://embed.bsky.app/oembed?%s" $query -}}
|
||||||
{{- $jsonOembed := resources.GetRemote $request -}}
|
{{- $jsonOembed := partial "function/get-remote-json" (dict "URL" $request) -}}
|
||||||
{{- $jsonOembed = $jsonOembed | transform.Unmarshal -}}
|
{{- $jsonOembed.html | safeHTML -}}
|
||||||
{{- $jsonOHTML := $jsonOembed.html -}}
|
|
||||||
{{- $jsonOHTML | safeHTML -}}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user