Linux 软件免费装
Banner图

Block for Strava

开发者 obenland
更新时间 2026年5月7日 08:42
PHP版本: 8.1 及以上
WordPress版本: 6.9
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

embed block fitness activity strava

下载

1.0.0

详情介绍:

Block for Strava adds a single block to the editor that embeds Strava activities, routes, and segments inside a sandboxed iframe. Public resources embed from a URL; followers-only and private activities embed via the share-dialog snippet from Strava (which carries a per-share token sent to Strava as part of the iframe URL). When a visitor views a post containing the block, their browser loads the embed iframe directly from strava-embeds.com; for short share links (strava.app.link/…), the site server makes a HEAD request to Strava to resolve the canonical URL. See the External services section below for full details. Features: Trademark Notice: Strava is a trademark of Strava Inc. This plugin is not affiliated with or endorsed by Strava Inc.

安装:

  1. Upload the plugin files to /wp-content/plugins/block-for-strava/, or install directly from the WordPress Plugins screen.
  2. Activate the plugin.
  3. In the block editor, open the inserter, search for "Strava", and pick the block. Or just paste a Strava URL onto its own line in the post — it auto-converts to a Strava block.
  4. Paste any Strava activity, route, or segment URL into the placeholder. For routes, use the Inspector panel to tweak map style, terrain, units, and so on.
For non-public activities (visibility set to "Followers" or "Only You"), copy the embed snippet from Strava's share dialog (Share → Embed) and paste it on its own line — the Strava block picks up both the activity and the per-share token so the iframe loads.

升级注意事项:

1.0.0 Initial release.

常见问题:

Does this work with private activities, routes, or segments?

It depends on the resource type. Public ("Everyone") activities, routes, and segments embed from a URL alone. Followers-only and private activities embed via Strava's share-dialog snippet — paste the <div class="strava-embed-placeholder" …>…</div> block (with its data-token share token) on its own line and the Strava block picks it up. The block round-trips a share token attribute for any resource type, so if Strava ever exposes a share-dialog snippet for a non-public route or segment, the same paste flow will carry that token through; in practice today Strava's share-with-token UI is on activities only, so non-public routes and segments can't be embedded yet.

Do I need a Strava account?

Visitors don't need any account or API key — they just see the embedded iframe. The block uses Strava's public embed feature, which doesn't require API access on this side. To embed a followers-only or private activity, the post author needs a logged-in Strava session to open Share → Embed in Strava's UI and copy the snippet (the snippet carries the per-share token Strava requires for those embeds). Authors embedding only public Strava URLs don't need an account either.

What URL formats are supported?

Full canonical URLs — https://www.strava.com/activities/12345678, https://www.strava.com/routes/12345, https://www.strava.com/segments/67890 — and Strava short share links (https://strava.app.link/…). The share-dialog embed snippet (the <div class="strava-embed-placeholder" …>…</div> block from Strava's Share → Embed dialog) is also supported and is the path to use for non-public activities, since it carries the per-share token Strava requires for those embeds.

Why does this plugin run server-side PHP?

Strava does not publish a public oEmbed endpoint. The block has a PHP render callback that generates the iframe markup deterministically from the saved URL and route attributes. The plugin runs no admin pages, options screens, or scheduled tasks. It does register a single editor-only REST route (/wp-json/block-for-strava/v1/embed-status) that the block's edit component calls to determine whether a saved activity URL needs a share token — the route is gated on edit_posts capability and is not used by the front end.

更新日志:

1.0.0