Comments (7)
- You have
href
commented in your code. That was the right way to pass it as embed URL. Paired withtext/html
type, Iframely would no to convert it into iFrame. What you were missing is the sizing information. You could either give"aspect-ratio"
in the object, or, say, justheight
to make the embed stretch 100% of the width. To make a fixed iFrame, you can just pass width & height. rel
inline is the secondary rel, which is meant to indicate whether embed can be rendered via JavaScript or not. You need a main one too. I suggest[CONFIG.R.app, CONFIG.R.ssl, CONFIG.R.html5]
. The flag for inline/js status isn't necessary if you return data as href rather than html. Iframely knows that iFrames are JS-friendly.- Last but not least, in v0.8.6 we added an option to use
"*"
as a mixin. It adds all generic mixins, and basically means that plugin will add an embed rather than take complete control:mixins: ["*"]
from iframely.
I've updated the domain file with your recommandations:
module.exports = {
re: [
/^http[s]?:\/\/cf.datawrapper.de\/(.+?)(?:[\/](?:index\.html)?)?$/
],
mixins: [
"*"
],
getLink: function(urlMatch) {
return {
type: CONFIG.T.text_html,
rel: [CONFIG.R.app, CONFIG.R.ssl, CONFIG.R.html5],
href: "http://cf.datawrapper.de/" + urlMatch[1] + "/",
height: 350
}
},
getMeta: function() {
return {
site: 'datawrapper',
};
},
tests: [
"http://cf.datawrapper.de/zjCKi/2/",
"http://cf.datawrapper.de/Gx44C/21/",
"http://cf.datawrapper.de/RrO5t/2/"
]
};
But it doesn't generate the iframe:
{
"meta": {
"title": "Montant total des amendes infligées par les régulateurs américains",
"canonical": "http://cf.datawrapper.de/zjCKi/2/"
},
"links": [
{
"href": "http://cf.datawrapper.de/favicon.ico",
"type": "image",
"rel": [
"icon"
]
}
]
}
from iframely.
That would mean that domain plugin isn't called. I suggest to verify the regex, perhaps escape dots \.
?
I just ran your code locally with /^https?:\/\/cf\.datawrapper\.de\/([a-zA-Z0-9]+)\//i
and it works fine. Not sure if it's the correct one though.
Also, did you know there's a local debug tool at http://localhost:8061/debug ?
from iframely.
.@nleush mentions that your regex matches, but there might be another issue at Iframely core here.
There is a validator at Iframely core that removes embeds with iframe src = canonical address (or original URL). In your case, the urlMatch[1]
would be like zjCKi/2
and you'll end up having iFrame exactly the same as URL (from your tests).
That validator is for generic parsers, especially for Open Graph. A lot of people just put og:video=canonical. Unfortunately, we can not remove this check. To work it around, you could add some query string to iFrame src, like ?for=iframely
or something.
from iframely.
Of course I know the debug tool, I mostly used to test the domain
And THANKS for that point @nleush I started to dig into the core.js to find why my regex is valid outside IFramely but not inside.
It works great now.
Thanks guys
from iframely.
@iparamonau Should I submit a PR to add this domain in plugins?
from iframely.
@j0k3r Sure, would be great. Thanks!
from iframely.
Related Issues (20)
- iFramely 1.6.1 - no reconnect to Redis or blocking request HOT 5
- Missing meta description, site, author and date HOT 2
- Any hints or beginner guide about how to get more information? HOT 1
- Twitter embeds cut off at the bottom HOT 2
- Spotify Video podcast do not have the right aspect ratio HOT 1
- Missing attributes for Spotify embeds HOT 2
- Batch querying by content IDs does not work HOT 1
- Facebook public posts redirect to facebook.com/login HOT 4
- Intermittent issues with Google share links HOT 4
- Inspect Network Calls HOT 1
- AWS cli for pushing build image
- New Tumblr embeds HOT 2
- Issue with a long html page without javascripts. HOT 2
- remove racially loaded terms from the website HOT 1
- Core plugins tests are failing in Node 18 HOT 5
- Better aspect ratio for Loom embeds HOT 1
- Tweet with media are failing in self hosted version HOT 3
- Tweet with media are failing in self hosted version HOT 1
- Tweet with media are failing in self hosted version HOT 1
- Self-hosted, instagram embed, redirect loop. HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iframely.