buttondown / roadmap

Buttondown's public roadmap
53 stars 0 forks source link

Add ld/json to subscribe pages #2711

Closed jmduke closed 2 months ago

catdevnull commented 2 months ago

Any previous art? I also can't seem to find a type/schema to use. Maybe https://schema.org/SubscribeAction?

see: https://buttondownemail.slack.com/archives/C0724K1HW8K/p1724184112402979

jmduke commented 2 months ago

ah doi. How about just WebSite? It can be fairly generic, but also that's a super-rich type so there's a lot to populate.

catdevnull commented 2 months ago

I'm not sure what to populate or not as I don't really have a target. Google doesn't seem to care about WebSite. Would this be enough?


    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "WebSite",
        "url": "{{ newsletter.get_absolute_url }}",
        "name": "{{ newsletter.name }}",
        "description": "{{ newsletter.description }}",
        {% if newsletter.icon %}
        "image": {
            "@type": "ImageObject",
            "contentUrl": "{{ newsletter.icon }}",
            "thumbnailUrl": "{{ newsletter.icon }}"
        },
        {% endif %}
        "publisher": {
            "@type": "Organization",
            "name": "{{ newsletter.name }}",
            "url": "{{ newsletter.get_absolute_url }}",
            "description": "{{ newsletter.description }}",
            {% if newsletter.icon %}
                "identifier": "{{ newsletter.id }}",
                "image": {
                    "@type": "ImageObject",
                    "contentUrl": "{{ newsletter.icon }}",
                    "thumbnailUrl": "{{ newsletter.icon }}"
                }
            {% else %}
                "identifier": "{{ newsletter.id }}"
            {% endif %}
        }
    }
    </script>
jmduke commented 2 months ago

That looks good, with a couple additions:

catdevnull commented 2 months ago

mainEntityOfPage

What's supposed to be the value of this?

sameAs, populated with any social network links that the newsletter has

Ugh, newsletter.social_networks isn't directly an array of URLs, but rather something like { twitter: 'esoesnulo', github: 'catdevnull' }. I can't find a helper function that converts these to URLs, only app/emails/templates/subscriber_facing/snippets/social.html which converts it into HTML anchors.

Should we wait until #3308 to add those instead?

jmduke commented 2 months ago

mainEntityOfPage

Just the absolute url as well. I think it's basically the same thing/concept as a rel=canonical

social network

Yeah, I think that can be a fast-follow. https://github.com/buttondown/roadmap/issues/2736 is also relevant here: we should refactor how those work for many reasons, and now we have one more such reason