fix: support meta[name="twitter:card"]

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-10-22 18:52:58 +09:00
parent 5723ba50fd
commit 151d0b8d11
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99

View File

@ -3,10 +3,18 @@ import type { PrioritizedReference } from "../common";
export default function getCard(url: URL, html: HTMLRewriter) {
const result: PrioritizedReference<string | null> = {
bits: 1, // 0-1
bits: 2, // 0-3
priority: 0,
content: null,
};
html.on('meta[name="twitter:card"]', {
element(element) {
const content = element.getAttribute("content");
if (content) {
assign(result, 2, content);
}
},
});
html.on('meta[property="twitter:card"]', {
element(element) {
const content = element.getAttribute("content");