-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Squarespace #3243
base: master
Are you sure you want to change the base?
Squarespace #3243
Conversation
Translator for Squarespace blogs. Should work with most templates Only search pages that put a data-url attribute on results are supported
Normalize line endings to CR LF
We are in 2024
Remove code to scrape <meta name="datePublished"> tags, which Squarespace blogs don't use. They use <meta itemprop="datePublished"> instead, which is already handled
Add test case for tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I wrote out a bunch of suggestions, but I'm actually wondering whether it would make more sense to fold this into the Embedded Metadata translator like we already do for WordPress blogs rather than adding a new empty-target translator.
Squarespace.js
Outdated
} | ||
|
||
function getMetadataItem(doc, prop) { | ||
return attr(doc, 'html>head>meta[itemprop="' + prop + '"]', 'content'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we need the extra specification and not just meta[itemprop="${prop}"]
? <meta>
tags are valid in the body and we don't normally restrict the selector unless there's a very good performance argument for doing so (e.g. detection in Embedded Metadata).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the selector from some other translator (Embedded Metadata probably). I'll simplify it
As suggested by @AbeJellinek: - use relative URLs in search results - accept meta tags from anywhere in the page - don't set website type - use ZU.cleanAuthor to build the creator - use Array.from instead of Array.prototype.slice.call Additionally, call ZU.trimInternal on the abstract, to normalize whitespace Update test cases accordingly
Translator for Squarespace blogs. Should work with most templates
Only search pages that put a data-url attribute on results are supported
Has a priority of 300 so that it has higher priority than Embedded Metadata, which is supported for Squarespace blogs but insufficient