Skip to content

Commit

Permalink
Docs: 增加 spotify shortcode (hugo-fixit/FixIt#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Jun 8, 2024
1 parent 56f4146 commit 1757254
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 3 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Extended Shortcode - spotify
date: 2024-05-20T11:06:24+08:00
type: posts
author:
name: Lruihao
link: https://lruihao.cn
description: The spotify shortcode embeds a responsive music player for Spotify music.
resources:
- name: featured-image
src: featured-image.webp
tags:
- Shortcodes
- Content
categories:
- Documentation
---

The `spotify` shortcode embeds a responsive music player for Spotify music.

<!--more-->

## Usages

Example `spotify` input:

```go-html-template
{{</* spotify type=artist id=74ASZWbe4lXaubB36ztrGX */>}}
Or
{{</* spotify artist 74ASZWbe4lXaubB36ztrGX */>}}
```

The rendered output looks like this:

{{< spotify artist 74ASZWbe4lXaubB36ztrGX >}}

## Options

The `spotify` shortcode has the following named parameters:

- **type** _[required]_ (**first** positional parameter)

The `type` of the Spotify music, which can be `artist`, `album`, `track`, or `playlist`.

- **id** _[required]_ (**second** positional parameter)

The `id` of the Spotify music, which can be found in the Spotify URL.

- **width** _[optional]_ (**third** positional parameter)

The `width` of the Spotify music player.

- **height** _[optional]_ (**fourth** positional parameter)

The `height` of the Spotify music player.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: 扩展 Shortcode - spotify
date: 2024-05-20T11:06:24+08:00
type: posts
author:
name: Lruihao
link: https://lruihao.cn
description: spotify shortcode 提供了一个内嵌的响应式音乐播放器。
resources:
- name: featured-image
src: featured-image.webp
tags:
- Shortcodes
- Content
categories:
- Documentation
---

`spotify` shortcode 提供了一个内嵌的响应式音乐播放器。

<!--more-->

## 快速使用

一个 `spotify` 示例:

```go-html-template
{{</* spotify type=artist id=74ASZWbe4lXaubB36ztrGX */>}}
Or
{{</* spotify artist 74ASZWbe4lXaubB36ztrGX */>}}
```

呈现的输出效果如下:

{{< spotify artist 74ASZWbe4lXaubB36ztrGX >}}

## 详细参数

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

- **type** _[必需]_ (**第一个**位置参数)

Spotify 音乐的 `type`,可以是 `艺术家``专辑``曲目``播放列表`

- **id** _[必需]_ (**第二个**位置参数)

Spotify 音乐的 `id`,可以在 Spotify URL 中找到。

- **width** _[optional]_ (**第三个**位置参数)

Spotify 音乐播放器的宽度。

- **height** _[optional]_ (**第四个**位置参数)

Spotify 音乐播放器的高度。
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.20

require (
github.com/Lruihao/hugo-shortcode-sponsor-log v1.0.0 // indirect
github.com/hugo-fixit/FixIt v0.3.8-0.20240606030604-6eaae7470851 // indirect
github.com/hugo-fixit/FixIt v0.3.8-0.20240608042704-678e2c0053c6 // indirect
github.com/hugo-fixit/component-projects v1.1.1 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/Lruihao/hugo-shortcode-sponsor-log v1.0.0 h1:HN1tKv3xYVZRSz+xt2Wr3hLbqxi5yK6OZRecYj22yyU=
github.com/Lruihao/hugo-shortcode-sponsor-log v1.0.0/go.mod h1:B0v1x6BWWp5g6w82hBfZkJNPTyTw8Cvt6ccZ7BllA20=
github.com/hugo-fixit/FixIt v0.3.8-0.20240606030604-6eaae7470851 h1:5T1RJoZ3+f6Y1mtyNmCfnH3acpcgGbYrG8EwVU2nRGk=
github.com/hugo-fixit/FixIt v0.3.8-0.20240606030604-6eaae7470851/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/FixIt v0.3.8-0.20240608042704-678e2c0053c6 h1:OFmX9EfcudAUxIyD2ij8vAaSC3gN8LyO7OUm1SfA9lc=
github.com/hugo-fixit/FixIt v0.3.8-0.20240608042704-678e2c0053c6/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/component-projects v1.1.1 h1:iFwd/pWCSQ5LQoyb82Fsi21YP8Xrv4A5YDOYPXbpP/U=
github.com/hugo-fixit/component-projects v1.1.1/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c=

0 comments on commit 1757254

Please sign in to comment.