Home / Developers / Embedding the reader
Embedding the reader
The reader is an HTML element. It runs directly in your page without an iframe; your CSS and the reader's do not affect each other.
Basic form
<script type="module" src="https://embed.epaper.guru/madlab-epaper.js"></script>
<madlab-epaper collection="TITEL-GUID"></madlab-epaper>
The script once per page, the element where the reader should appear. You find the ready-made code for each title in the portal under Readers → Embed. Without further settings, the reader shows the title's archive.
Attributes
| Attribute | Meaning |
|---|---|
collection | Title GUID (required) |
issue, page | open an issue directly, optionally on a specific page |
open | how an issue opens: inline (in the reader), overlay (over the page) or window (new window) |
start | archive or latest (straight to the newest issue) |
layout | auto, single or double (spreads) |
lang | de, fr, it or en. Without it, the page's language applies. |
session | session of a logged-in subscriber (st_…) if your website does the login on the server. See One login for website and e-paper. |
Most settings are made in the portal (Readers → Embed); they then apply on every website without changing the code. Attributes take precedence over the portal settings.
Appearance
Colours, font and height via CSS variables on your website:
madlab-epaper {
--madlab-epaper-height: 80vh;
--madlab-epaper-accent: #c8102e;
--madlab-epaper-font: Georgia, serif;
/* ausserdem: --madlab-epaper-bg, --madlab-epaper-surface,
--madlab-epaper-text, --madlab-epaper-muted */
}
Events
The reader reports what the reader does, for example for your own statistics or to keep the page address in sync:
const reader = document.querySelector('madlab-epaper')
reader.addEventListener('issuechange', (e) => console.log('Ausgabe', e.detail[0]))
reader.addEventListener('pagechange', (e) => console.log('Seite', e.detail[0].page))
Protected issues
If a title is protected, the reader shows a login form when a protected issue is opened. If the reader is already logged in on your website, it doesn't: the reader takes over the website's login (see Login and paywall).
Dedicated reader page
Each title also has its own page, for links in emails, newsletters and QR codes:
https://embed.epaper.guru/r/TITEL-GUID
https://embed.epaper.guru/r/TITEL-GUID/AUSGABE-GUID