Skip to content

HTML to Atom: title element has encoded HTML #629

Closed

Description

@gRegorLove

Minor, but I noticed with this feed that one of my notes has encoded HTML getting into the <title>:

<title>I like this CSS image reset after watching Kevin Powell’s walkthrough. &lt;...</title>

The original post uses e-content and I'm guessing Granary is using the parsed html attribute for the title. A possible solution might be to use value attribute instead, for posts that don't have a name of course:

    "content": [
        {
            "html": "<p>I like this CSS image reset after watching <a href=\"https://www.youtube.com/watch?v=345V2MU3E_w\">Kevin Powell&#x2019;s walkthrough</a>.</p>\n\n<p>Also intrigued by the post he linked, &#x201C;<a class=\"h-cite\" href=\"https://csswizardry.com/2023/09/the-ultimate-lqip-lcp-technique/\">The Ultimate Low-Quality Image Placeholder Technique</a>.&#x201D;</p>",
            "value": "I like this CSS image reset after watching Kevin Powell\u2019s walkthrough.\nAlso intrigued by the post he linked, \u201cThe Ultimate Low-Quality Image Placeholder Technique.\u201d",
            "lang": "en"
        }
    ],

Activity

  1. gRegorLove commented on Nov 9, 2023

    @gRegorLove
    Author

    Oh I just realized it's not the first youtube <a href> getting encoded, but some later HTML element. I'm not sure then. Let me know if something is off with my HTML that's causing it then.

  2. snarfed commented on Nov 9, 2023

    @snarfed
    Owner

    Huh! Thanks for the nudge. This is an odd one! It doesn't reproduce locally for me at all, with either the /stream/ feed or the specific post; both have <title>I like this CSS image reset after watching Kevin Powell’s walkthrough. </title>, no &lt;.... I do see it on prod https://granary.io/ with both though. Hrm.

  3. snarfed commented on Jan 22, 2024

    @snarfed
    Owner

    Looked at this again, I'm now able to reproduce it locally. Output is still a bit different, I'm guessing that's because I'm using a different HTML parser locally vs in prod.

    I suspect we're generating title from HTML content, then ellipsizing, and we end up with just the opening < of a tag, which we then entity-encode.

  4. snarfed commented on Jan 22, 2024

    @snarfed
    Owner

    Fixed!

  5. added a commit that references this issue on Feb 3, 2024
    a5792ae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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