forem/forem · error · StandardError

Invalid Slideshare Key

Error message

Invalid Slideshare Key

What it means

Forem's {% slideshare %} tag accepts either the embed URL https://(www.)slideshare.net/slideshow/embed_code/key/<12-14 word characters> or a bare 12-14 character key; parse_input raises when input matches neither regexp.

Source

Thrown at app/liquid_tags/slideshare_tag.rb:28

    stripped_input = strip_tags(input)
    @key = parse_input(stripped_input)
  end

  def render(_context)
    ApplicationController.render(
      partial: PARTIAL,
      locals: {
        key: @key,
        height: 487
      },
    )
  end

  private

  def parse_input(input)
    match = pattern_match_for(input, REGEXP_OPTIONS)
    raise StandardError, I18n.t("liquid_tags.slideshare_tag.invalid_slideshare_key") unless match

    match[:id]
  end
end

Liquid::Template.register_tag("slideshare", SlideshareTag)

UnifiedEmbed.register(SlideshareTag, regexp: SlideshareTag::REGISTRY_REGEXP)

View on GitHub (pinned to f354c376a7)

Solutions

  1. Open the deck's Share -> Embed dialog and copy the embed_code/key URL: {% slideshare https://www.slideshare.net/slideshow/embed_code/key/AbCdEf123456 %}.
  2. Alternatively pass just the 12-14 character key: {% slideshare AbCdEf123456 %}.
  3. If the key length falls outside 12-14, the tag cannot embed it — link the deck plainly instead.

Example fix

// before
{% slideshare https://www.slideshare.net/jdoe/introducing-foo %}

// after
{% slideshare https://www.slideshare.net/slideshow/embed_code/key/FxYzAbC12345 %}
Defensive patterns

Strategy: validation

Validate before calling

SLIDESHARE_OK = %r{\A(https://(www\.)?slideshare\.net/slideshow/embed_code/key/)?\w{12,14}\z}
def slideshare_embeddable?(input)
  input.strip.match?(SLIDESHARE_OK)
end

Try / catch

begin
  Liquid::Template.parse(markdown).render
rescue StandardError => e
  show_editor_error(e.message)
end

Prevention

When it happens

Trigger: Pasting the canonical viewer URL (slideshare.net/username/slug — no embed_code/key segment), an embed key shorter than 12 or longer than 14 chars, or a URL with query params after the key that break the word-character run raise at app/liquid_tags/slideshare_tag.rb:28.

Common situations: Users copying the address-bar URL instead of the iframe embed URL from Slideshare's share dialog; Slideshare changing key lengths outside 12-14; HTML-escaped ampersands or trailing slashes breaking the match.

Related errors


AI-assisted analysis of forem/forem@f354c376a7 (2026-08-21). Data as JSON: /api/errors/0cd5e73e6d7289e7. Report an issue: GitHub.