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

📝 Add internal Dojo API to write News article much easier #1433

Merged
merged 1 commit into from May 17, 2022

Conversation

yasulab
Copy link
Member

@yasulab yasulab commented May 17, 2022

下記お知らせ記事の「寄贈先の CoderDojo 一覧」を簡単に作りたい。

「CoderDojo 一覧」が用意されているお知らせ記事の例
https://news.coderdojo.jp/2022/05/16/1500-microbits-to-coderdojo/

image

# 上記記事の HTML における出力パターン
<ul>
  <li>
    <a href='#{dojo.url}'>'#{dojo.name}</a>(#{dojo.prefecture.region})
  </li>
  <li> ... (上記パターンで Dojo の数だけ続く) </li>
</ul>

上記記事では「 手書き 」で用意したが、ケアレスミスが発生する可能性もあり、何より1つずつ参照・確認するのに1時間以上かかった。今後は本 API を活用して自動的に生成したい 😌 ✨ (楽したい... 😂)

そこで、与えられた Dojo 名と一致した Dojo のリンク付きテキストを返し、
今後同様のセクションを作るときは本 API で Dojo 一覧のリストを用意できるようにした。

Dojo API の出力例 GET /dojos.json

{
  name: "柏",
  url: "https://www.coderdojo-kashiwa.com/",
  prefecture: "関東",
  linked_text: "<a href='https://www.coderdojo-kashiwa.com/'>'柏</a>(関東)"
}

image

実行スクリプトと使い方

下記スクリプトを実行することでお知らせ記事に必要な HTML が取得できます。

下記お知らせ記事の「寄贈先の CoderDojo 一覧」を簡単に作りたい。
与えられた Dojo 名と一致した Dojo のリンク付きテキストを返し、
今後同様のセクションを作るときは本 API で Dojo 一覧のリストを用意する。

「CoderDojo 一覧」が用意されているお知らせ記事の例
https://news.coderdojo.jp/2022/05/16/1500-microbits-to-coderdojo/
@yasulab yasulab added ニュース Features for press releases built by WordPress: https://news.coderdojo.jp/ アイデア Ideas to improve business. labels May 17, 2022
@yasulab yasulab changed the title Add internal Dojo API to make news easier 📝 Add internal Dojo API to write News article much easier May 17, 2022
@yasulab yasulab merged commit cfbaacb into main May 17, 2022
@yasulab yasulab deleted the add-internal-api-for-dojos branch May 17, 2022 08:12
yasulab added a commit that referenced this pull request May 17, 2022
yasulab added a commit that referenced this pull request May 17, 2022
yasulab added a commit that referenced this pull request May 17, 2022
yasulab added a commit that referenced this pull request May 18, 2022
yasulab added a commit that referenced this pull request May 18, 2022
yasulab added a commit that referenced this pull request May 18, 2022
yasulab added a commit that referenced this pull request May 18, 2022
yasulab added a commit that referenced this pull request May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
アイデア Ideas to improve business. ニュース Features for press releases built by WordPress: https://news.coderdojo.jp/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant