Get page content HTML optimized for mobile consumption.
Gets the content HTML optimized for mobile consumption for the given page. This content is derived from Parsoid HTML (see /page/html/{title} endpoint). The difference to Parsoid HTML is roughly:
- Some elements and attributes not needed for the reading case are removed.
- LeadIntroductionTransform: The introductory paragraph is moved before an infobox.
- RedLinks: Red links are flattened (=turned into span elements).
- WidenImage: images that should be displayed in gallery are widened.
- Section headings are slightly changed by wrapping the headings inside a div and adding a span element inside the new div for the edit buttons.
- Additional classes are added to img elements to fix issues with non-white backgrounds. See Theme support below for instructions on how to enable that.
- Pagelib CSS files needed to display the content are referenced.
- LazyLoadTransform: server-side portion/prep for lazy loading of images.
- CollapseTable: server-side portion/prep for collapsing tables.
What's not included? What parts of the PageLibrary does a client still have to do?
-
Theme support: Themes can be turned on by adding a theme class to the root <html> tag. Possible class names are:
- pagelib_theme_default
- pagelib_theme_dark
- pagelib_theme_black
- pagelib_theme_sepia
The pagelib JS has functionality to do that: ThemeTransform.setTheme(document, theme).
-
Dim images: DimImagesTransform.dim(window, enable)
-
PlatformTransform.classify(window) to trigger Android and iOS app specific CSS rules
-
LazyLoadTransformer: client side companion of LazyLoadTransform (note the extra er here)
-
FooterTransformer: seems to be more UI than content, requires I18N, too
Stability: experimental
Request
- Base URL: https://en.wikipedia.org/api/rest_v1
- URL: https://en.wikipedia.org/api/rest_v1/page/mobile-html/{title}/{revision}
- Auth: none declared
Path parameters
Page title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.
Query parameters
Requests for redirect pages return HTTP 302 with a redirect target in Location header and content in the body. To get a 200 response instead, supply false to the redirect parameter.
Response
mobile-optimized HTML of the given page.
Changes
No recorded changes to this operation across all 1 revision of this API.