Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
There are screenshots in the post that we're commenting on that show examples of this happening with Ali's post. The original canonical_url on medium points back to her dev.to post. The new site points back to the medium post, a different url.
I'm a self-taught Front End & JS Dev and professional learner with accessibility expertise. I'm passionate about breaking down concepts into relatable concepts, making it more approachable.
Eg they say a post object has a canonicalUrl, attribute. I can't tell from reading the docs, whether you can GET them via the API. All the examples are creating Medium posts via POST requests, and none are showing existing posts via GET requests.
But you presumably found some way to get it, so if you're getting it through an API endpoint, then check it for the canonicalUrl attribute. And if you're getting it by scraping it, then check for the link tag, eg this prints the expected value:
There are screenshots in the post that we're commenting on that show examples of this happening with Ali's post. The original canonical_url on medium points back to her dev.to post. The new site points back to the medium post, a different url.
I would check the one Ben put in this blog post.
Looks like you might be able to get it via the API: github.com/Medium/medium-api-docs#...
Eg they say a post object has a
canonicalUrl
, attribute. I can't tell from reading the docs, whether you canGET
them via the API. All the examples are creating Medium posts viaPOST
requests, and none are showing existing posts viaGET
requests.But you presumably found some way to get it, so if you're getting it through an API endpoint, then check it for the
canonicalUrl
attribute. And if you're getting it by scraping it, then check for thelink
tag, eg this prints the expected value:(in reality, I'd use the CSS selector
link[rel="canonical"]
, but I wanted an example that didn't require installing fancy tooling)