Skip to content

Clone A Web Page Layout From A Screenshot

Posted on:September 3, 2024 at 05:00 PM

Clone A Web Page Layout From A Screenshot

Github Project Repo is here

If you need a landing page but you don’t have any good ideas, find an existing website that you like and steal clone its layout. Of course, you could just download the files and hack them yourself, but there will be a lot of stuff in there you don’t want. Instead, use an AI tool to copy its layout and use that.

This is a very simple project, but it did one thing I didn’t expect that was impressive. See the results below.

In this demo, I’m going to use the following:

You should get similar results if you generate the code with other tools, but following the same prompts. The important things are the prompts, which are shown below

Get Ready

Start Coding

Create a working directory and cd into it.

Pick A Web Page You LIke

I’m going to use the landing page from Supabase, because I use Supabase, and it looks good and modern for a dev product.

Copy The Layout With Aider/Claude

—Prompt—

/add supabase.png

—Prompt—

create a landing page for a website. duplicate the layout of supabase.png. use html, css and javascript as necessary. name the output files index.html,style.css and script.js.

—Prompt—

create a simple static web server using python so I can test the results

You will get a short python file. Aider might ask if you want to run it. Say yes or run it in a separate terminal. If you way yes it will

Now See The Magic

Update The Page

Of course we don’t actually want to duplicate supabase itself (that would be unethical, illegal, or at least it would be a lot of work), just the layout, so give it a couple of more prompts.

—Prompt—

substitute the original text in index.html with lorum ipsum text

If it asks to add the URL to the chat, say NO because it will think you want to scrape that page. We dont want to do that.

—Prompt—

in index.html, modify all anchor tabs to point to https://news.ycombinator.com/

The End Result

Of course your results may differ because different models may do something different. Even the same one may do something different if you repeat the process clean.

Maybe the most import thing it generated was a valid style.css file that you could use on any project to get a similar vibe.

The code here includes the python server so you can run it as is. Here’s a screenshot of the final project.

screenshot of update landing page

Cost

This exercise cost me $0.15 using Anthropic.