A service to add web page screenshots to your Eleventy sites.

Related tags

CSS api-screenshot
Overview

Screenshot API

A runtime service to use live website screenshots on your site.

Usage

Image URLs have the formats:

https://v1.screenshot.11ty.dev/:url/
https://v1.screenshot.11ty.dev/:url/:size/
https://v1.screenshot.11ty.dev/:url/:size/:aspectratio/
https://v1.screenshot.11ty.dev/:url/:size/:aspectratio/:zoom/
  • url must be URI encoded.
  • Valid size values:
    • small: 375×___ (default)
    • medium: 650×___
    • large: 1024×___
      • aspectratio of 9:16 is not supported (throws an error)
    • opengraph: always 1200×630, works with zoom
      • aspectratio is ignored (no errors thrown)
  • Valid aspectratio values:
    • 1:1 (default)
    • 9:16
  • Valid zoom values:
    • bigger (1.4 devicePixelRatio)
    • smaller (0.71 devicePixelRatio)

Advanced: Manual Cache Busting

If the screenshots aren’t updating at a high enough frequency you can pass in your own cache busting key using an underscore prefix _ after your URL.

This can be any arbitrary string tied to your unique build, here’s an example that uses today’s date:

https://v1.screenshot.11ty.dev/:url/_20210802/
https://v1.screenshot.11ty.dev/:url/:size/_20210802/
https://v1.screenshot.11ty.dev/:url/:size/:aspectratio/_20210802/
https://v1.screenshot.11ty.dev/:url/:size/:aspectratio/:zoom/_20210802/

Deploy

Deploy to Netlify

Comments
  • Error: Invalid `url`: .netlify

    Error: Invalid `url`: .netlify

    Is there something I have to configure in Netlify to have it skip the .netlify/functions/screenshots when making a request for a screenshot?

    Calling the function with this in the path results in an error Invalid url: .netlify

    Thanks.

    bug 
    opened by scottwater 9
  • CSS features seem to be unsupported on headless Chromium

    CSS features seem to be unsupported on headless Chromium

    I am pretty sure that this is the wrong place to open this issue and not a problem with your scripts, but somehow it might be helpful to see whatever solution this brings for others: I am using a specific CSS3-feature that seems to be broken in the screenshots.

    Screenshot:

    _20210803

    Original (with Chrome browser loaded):

    Screenshot 2022-03-08 at 21-37-05 Creating a GPG Key for Github Gitlab Deployment - kollitsch de

    Could you maybe point me in a direction what exactly is the issue here?

    Problems:

    • dark theme is default, light theme is used (cache? I just changed today to the dark theme as default, but adding random characters to the URL won't load a dark theme screenshot)
    • background-clip is not working - code

    Is the headless Chrome somehow in-capacitated in regards to specific features? I thought the used browser in puppeteer is the latest version...

    opened by davidsneighbour 5
  • unnecessary code?

    unnecessary code?

    I feel like this piece is doing nothing...

    https://github.com/11ty/api-screenshot/blob/36407cf678a8c1633b0f816ca59a582bdd78c7b8/functions/screenshot.js#L43-L45

    opened by theiliad 5
  • Build breaking due to incorrect dependency resolution

    Build breaking due to incorrect dependency resolution

    Building fails since a8b6b69 due to chrome-aws-lambda requiring puppeteer-core 10.1.*.

    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR! 
    npm ERR! While resolving: [email protected]
    npm ERR! Found: [email protected]
    npm ERR! node_modules/puppeteer-core
    npm ERR!   puppeteer-core@"^13.4.0" from the root project
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peer puppeteer-core@"^10.1.0" from [email protected]
    npm ERR! node_modules/chrome-aws-lambda
    npm ERR!   chrome-aws-lambda@"^10.1.0" from the root project
    npm ERR! 
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR! 
    npm ERR! See /Users/alexandersandberg/.npm/eresolve-report.txt for a full report.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/alexandersandberg/.npm/_logs/2022-03-06T11_11_34_128Z-debug-0.log
    

    Solution

    Downgrade puppeteer-core.

    opened by alexandersandberg 3
  • chrome-aws-lambda not compatible with Node 16, using a replacement is too large to deploy

    chrome-aws-lambda not compatible with Node 16, using a replacement is too large to deploy

    After cloning this repo and deploying a new Netlify site, my site function wasn't generating images even when using exactly the same URL syntax as used on 11ty.dev.

    Here's my original question on the 11ty Discord forum: https://discord.com/channels/741017160297611315/1039318195644928060

    The problem appears to be chrome-aws-lambda not running correctly on Node 16. LewisDaleUK attempted to submit a PR ( https://github.com/11ty/api-screenshot/pull/14 ) using @sparticuz/chromium as a better-maintained replacement, but changing the dependency increases the package size over the 50 MB limit for functions.

    Because Netlify is switching all new deploys to Node 16, this effectively means this project can't be used to launch new sites on Netlify.

    bug 
    opened by stephenjbell 2
  • fix: force nodejs 12

    fix: force nodejs 12

    I couldn't make this repo run by default on Netlify without downgrading Node.js versions.

    14/16 didn't work, but 12 worked

    I suggest specifying a version so that others trying to deploy it do not have to figure things out

    Related:

    • https://stackoverflow.com/questions/66214552/tmp-chromium-error-while-loading-shared-libraries-libnss3-so-cannot-open-sha/67117619#67117619
    • https://answers.netlify.com/t/lambda-function-failing-in-netlify-build-20-3-1/48900
    • https://answers.netlify.com/t/chrome-aws-lambda-stopped-working-possibly-due-to-different-version-of-netlify-build/48847
    bug documentation 
    opened by slorber 2
  • Discord Fails to show screenshots

    Discord Fails to show screenshots

    When linking to an 11ty screenshot image using either a direct link or an embed there is no image. Screenshot url: https://v1.screenshot.11ty.dev/https%3A%2F%2Fsplatoon.catgirlin.space%2Fopengraph%2F/opengraph/_wait:2_202249--1162/ image

    Link: https://splatoon.catgirlin.space/battles/VnNIaXN0b3J5RGV0YWlsLXUtYXFha3g1N21va3NzZWlic3pubW06UkVDRU5UOjIwMjIxMjExVDAyMjAwMl9jNDJmZWFhZi03NDA2LTRkY2YtYWY3MC0wNTNjZGMzYmE1Yjg/ Screenshot url: https://v1.screenshot.11ty.dev/https%3A%2F%2Fsplatoon.catgirlin.space%2Fopengraph%2Fbattles%2FVnNIaXN0b3J5RGV0YWlsLXUtYXFha3g1N21va3NzZWlic3pubW06UkVDRU5UOjIwMjIxMjExVDAyMjAwMl9jNDJmZWFhZi03NDA2LTRkY2YtYWY3MC0wNTNjZGMzYmE1Yjg%2F/opengraph/_wait:2_202249/ image

    In both cases, the image was already generated, so it shouldn't be a timeout issue. These links work fine on their own, and I haven't had an issue with open graph images anywhere else.

    opened by catgirlinspace 0
  • Chromium 50MB AWS Lambda Node 12 Mega Issue

    Chromium 50MB AWS Lambda Node 12 Mega Issue

    Spawned from #13. Related to #15.

    Ideally we could upgrade the node runtime https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html but newer versions of puppeteer blow past the 50MB AWS Lambda limit. I haven’t tested all versions of Puppeteer to see if there are some that work in Node 14 but don’t hit the 50MB limit yet.

    Right now the workaround/requirement is to put an environment variable in your Netlify app UI setting AWS_LAMBDA_JS_RUNTIME to nodejs12.x. This cannot be set via netlify.toml (https://answers.netlify.com/t/netlify-functions-and-env-variables-from-netlify-toml/4404/28)

    PR #14 uses the new package from Sparticuz: https://github.com/Sparticuz/chromium/issues/8

    There is a hard deadline on this one (March 31, 2023) as Node 12 in AWS is going away: https://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-node-js-12-x-in-the-aws-sdk-for-javascript-v3/

    Related:

    • Build plugin may workaround the netlify.toml issue https://github.com/bencao/netlify-plugin-inline-functions-env#readme
    • https://github.com/puppeteer/puppeteer/blob/da92055e9c187f4d0cce6ca548bc69689c452b6d/docs/troubleshooting.md
    • https://answers.netlify.com/t/chrome-aws-lambda-stopped-working-possibly-due-to-different-version-of-netlify-build/48847
    • https://answers.netlify.com/t/netlify-function-with-puppeteer-breaks-if-i-make-any-changes/76924
    bug: dependency 
    opened by zachleat 0
  • Font Weight is not preserved

    Font Weight is not preserved

    The font weight does not seem to be preserved.

    I tried the manual cache invalidation and custom wait conditions too but get the same results. This might be related to issue #9

    Example

    | Original | 11ty Screenshot | | :---: | :---: | | blendit-original | blendit-11ty-screenshot | | Original URL | 11ty API URL wait:2 | | projects-original | projects-11ty-screenshot | | Original URL | 11ty API URL |

    I'm using Bootstrap v5 and all custom CSS is minified inline. The NavBar and other styles from Bootstrap seem to load. I'm using the default font from bootstrap and am changing the font weight using custom CSS.

    SourceCode

    opened by imaginelenses 0
  • Enable puppeteer and Chromium to work with latest versions of Node.

    Enable puppeteer and Chromium to work with latest versions of Node.

    Update puppeteer-core and replace chrome-aws-lambda with @sparticuz/chromium

    The current code will only work with Node 12, meaning it can't be deployed out of the box as Netlify uses Node 16.

    The chrome-aws-lambda package hasn't been maintained in over a year, https://github.com/sparticuz/chromium is an alternative that provides the same functionality.

    This is now able to be auto-deployed by Netlify and run out-of-the-box again

    Sources:

    • https://answers.netlify.com/t/netlify-cli-dropping-support-for-node-js-version-12/75130
    opened by LewisDaleUK 2
  • Missing emoji

    Missing emoji

    via the original blog post:

    Update (July 30, 2021): The other issue I noticed with using Puppeteer in a Lambda is that emoji are not available to the rendered content. So if a site is using Emoji they do not render. It looks like Matic Jurglič may have a workaround to solve this.

    https://www.zachleat.com/web/screenshots/

    bug 
    opened by zachleat 0
  • Docs: explain how to deal with CORS

    Docs: explain how to deal with CORS

    I've installed this on my own domain screenshots.nicolas-hoizey.com hosted on Netlify.

    It works well when run in the browser: https://screenshots.nicolas-hoizey.com/https%3A%2F%2Fcloudfour.com%2Fthinks%2Fsvg-icon-stress-test%2F/large/

    But I get a CORS error when I try to use this image in a page on another domain: image

    I tried to add this to my netlify.toml file, but it doesn't fix the issue:

    [[headers]]
      for = "/*"
        [headers.values]
        Access-Control-Allow-Origin = "*"
    

    Is there something specific to do because it's a Netlify Function?

    There might be something here: https://stackoverflow.com/a/57974136/717195

    opened by nhoizey 0
The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.

Install | Documentation | Releases | Contributing Foundation is the most advanced responsive front-end framework in the world. Quickly go from prototy

Foundation 29.4k Jan 4, 2023
A Unique Food order landing page web application called 'HOMELY' where you can select available meals and add them to cart then order them.

End Result Click the link : https://foodapp-by-eniola.netlify.com Getting Started with Create React App This project was bootstrapped with Create Reac

Eniola Odunmbaku 26 Dec 31, 2022
Automatic GatsbyJS App Landing Page - Automatically generate iOS app landing page using GatsbyJS

Automatic GatsbyJS App Landing Page Create and deploy an iOS app landing page on GitHub Pages and Netlify in a couple of minutes ?? Fork this repo ??

Imed Adel 173 Jan 1, 2023
AngularJS SPA Template for Visual Studio is a project skeleton for a simple single-page web application (SPA) built with AngularJS, Bootstrap, and ASP.NET (MVC, Web Api, SignalR).

AngularJS SPA Template for Visual Studio This project is a skeleton for a simple single-page web application (SPA) built on top of the: AngularJS 1.2.

Kriasoft 105 Jun 18, 2022
A web app landing page theme created by Start Bootstrap

Start Bootstrap - New Age New Age is a web app landing page theme for Bootstrap created by Start Bootstrap. Preview View Live Preview Status Download

Start Bootstrap 996 Dec 26, 2022
🌆 Here I've aggregated some of the most commonly used web-page templates made using Bootstrap4 🛒

Web-page component templates using bootstrap4 Here are some of the most common web-page templates made using bootstrap4 Login page Create-Account or S

Akash Giri 89 Dec 30, 2022
Increase your landing page conversion rates.

Ouibounce Originally created by Carl Sednaoui from MailCharts. Maintained and improved by generous contributors. Ouibounce: A small library enabling y

Carl Sednaoui 2.3k Dec 9, 2022
Fluent UI web represents a collection of utilities, React components, and web components for building web applications.

Fluent UI Web ?? ?? ?? Version 8 of @fluentui/react is now available on npm! ?? ?? ?? See the release notes for more info, and please file an issue if

Microsoft 14.5k Jan 4, 2023
A responsive, Bootstrap landing page template created by Start Bootstrap

Start Bootstrap - Landing Page Landing Page is a multipurpose landing page template for Bootstrap created by Start Bootstrap. Preview View Live Previe

Start Bootstrap 1.4k Jan 3, 2023
Minimal landing page for developers

Dev Landing Page Minimal landing page for developers. Developers don't talk much. Their code does all the talking. So here's a minimal landing page fo

Dinesh Pandiyan 1.2k Jan 4, 2023
Esri GitHub landing page

esri.github.io Landing page for Esri open source projects. Both the project categories and search suggestions in http://esri.github.io are powered by

Esri 470 Dec 31, 2022
Tailwind CSS Starter Template - Landing Page

Tailwind Toolbox - Landing Page Template Landing Page is an open source, generic landing page template for Tailwind CSS created by Tailwind Toolbox. G

Tailwind Toolbox 908 Jan 8, 2023
Landing page starter

?? Fresh Fresh is a free landing page starter built by cssninjaStudio. ✌️ preview Check out the live demo by clicking here. Fresh is built with Bulma

cssninja 486 Dec 23, 2022
Startup Landing Page Components for React.js

neal-react neal-react is a collection of reactjs components to quickly build landing pages. I found that using hosted services like Launchrock doesn't

Denny Britz 1.4k Nov 30, 2022
🖼 A pure client-side landing page template that you can fork, customize and host freely. Relies on Mailchimp and Google Analytics.

landing-page-boilerplate A pure client-side landing page template that you can freely fork, customize, host and link to your own domain name (e.g. usi

Adrien Joly 129 Dec 24, 2022
Serverless Pre-Rendering Landing Page

Serverless Pre-Rendering Demo Read the blog post Checkout the demo Developing By default, the content on the site is based off our public Notion page.

Vercel 389 Dec 21, 2022
Material Design Based One Page HTML Template

Material Design One Page HTML Template MD One page template is fully responsive and free to use. This HTML template is based on Materialize, a CSS Fra

Joash 587 Jan 2, 2023
A simple, one page, Bootstrap HTML website template created by Start Bootstrap

Start Bootstrap - One Page Wonder One Page Wonder is a basic one page template for Bootstrap created by Start Bootstrap. Preview View Live Preview Sta

Start Bootstrap 327 Dec 18, 2022
Free responsive one page portfolio template

Portfolio one page template - ARCHIVED Flat and responsive website template, designed and coded by Maxim Orlov. Demo: http://website-templates.github.

Website templates 164 Jan 2, 2023