Skip to content

Support for Polls #881

@KStocky

Description

@KStocky

Feature Description

It would be great if Hextra supported adding polls to markdown.

Problem/Solution

This would give authors of a site the ability to introduce some interactivity to their site and gather information about the people reading their content.

A simple solution would be adding a partial/shortcode combo for embedding a strawpoll like so:

e.g.

layouts/_partials/_shortcodes/strawpoll.html

{{ $id := .id }}

<div class="strawpoll-embed" id="strawpoll_{{- $id -}}" style="height: 544px; max-width: 640px; width: 100%; margin: 0 auto; display: flex; flex-direction: column;">
    <iframe title="StrawPoll Embed" id="strawpoll_iframe_{{- $id -}}" src="https://strawpoll.com/embed/{{ $id }}" style="position: static; visibility: visible; display: block; width: 100%; flex-grow: 1;" frameborder="0" allowfullscreen allowtransparency>
        Loading...
    </iframe>
    <script async src="https://cdn.strawpoll.com/dist/widgets.js" charset="utf-8"></script>
</div>

layouts/_shortcodes/strawpoll.html

{{- $id := .Get "id" | default "" -}}

{{ partial "shortcodes/strawpoll.html" (dict "id" $id) }}

Alternatives Considered

I did have a look to see if there would be a way of using github backed polls in the same way that hextra uses giscus for comments that are backed by github discussions. But it seems like the API for github discussions doesn't support polls yet? If I am wrong however, then perhaps using github discussions for polls would be a better idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions