Skip to content
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

Option to display title on Documentcloud.org embeds #562

Merged
merged 11 commits into from
Nov 6, 2024
13 changes: 10 additions & 3 deletions plugins/domains/documentcloud.org.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default {
"author",
"og-title",
"og-image",
"og-description"
"og-description",
"oembed-title"
],

// plugin is required to add aspect-ratio and with this fix embeds when used inside iFrame
Expand All @@ -31,10 +32,11 @@ export default {

if (!/DC\-note/.test(html) && !/DC\-embed(?:\-page)?/.test(html)) {
var page = options.getRequestOptions('documentcloud.page', '1');
var title = !!options.getRequestOptions('documentcloud.title', false);

try {
var iframe = oembed.getIframe();
var href = iframe.src;
var href = title ? iframe.replaceQuerystring({ title: 1 }) : iframe.src;

if (page && page !== '1') {
if (href) {
Expand All @@ -51,6 +53,10 @@ export default {
page: {
label: CONFIG.L.page,
value: parseInt (page)
},
title: {
label: 'Show title',
value: title
}
}
} catch (ex) {}
Expand Down Expand Up @@ -95,7 +101,8 @@ export default {
'author',
'canonical',
'og-title',
'og-image'
'og-image',
'oembed-title'
]},
'https://www.documentcloud.org/documents/73991-day-three-documents',
'https://www.documentcloud.org/documents/5766398-ASRS-Reports-for-737-max8.html#document/p2/a486265',
Expand Down