From 7e72d518b6d344a656323524bfb4d3d0640d3607 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 21 Apr 2019 20:54:13 -0400 Subject: [PATCH] Improve SEO (#76) --- now.json | 3 +-- public/index.html | 3 ++- public/robots.txt | 1 + src/browser.ts | 3 ++- src/template.ts | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 public/robots.txt diff --git a/now.json b/now.json index a5ccac6..359bc80 100644 --- a/now.json +++ b/now.json @@ -11,8 +11,7 @@ ], "routes": [ { "src": "/", "dest": "/public/index.html" }, - { "src": "/favicon.ico", "dest": "/public/favicon.ico" }, - { "src": "/style.css", "dest": "/public/style.css" }, + { "src": "/(favicon.ico|style.css|robots.txt)", "dest": "/public/$1" }, { "src": "/dist/browser.js", "dest": "/browser.js" }, { "src": "/(.+)", "dest": "/src/card.ts" } ] diff --git a/public/index.html b/public/index.html index f629ec5..fee7d18 100644 --- a/public/index.html +++ b/public/index.html @@ -1,11 +1,12 @@ - + Open Graph Image as a Service + diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..4f9540b --- /dev/null +++ b/public/robots.txt @@ -0,0 +1 @@ +User-agent: * \ No newline at end of file diff --git a/src/browser.ts b/src/browser.ts index 3e8826a..838cef6 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -14,10 +14,11 @@ const ImagePreview = ({ src, onclick, onload, onerror, loading }: ImagePreviewPr filter: loading ? 'blur(5px)' : '', opacity: loading ? 0.1 : 1, }; + const title = 'Click to copy image URL to clipboard'; return H('a', { className: 'image-wrapper', href: src, onclick }, H('img', - { src, onload, onerror, style } + { src, onload, onerror, style, title } ) ); } diff --git a/src/template.ts b/src/template.ts index 523c34b..f61e0d0 100644 --- a/src/template.ts +++ b/src/template.ts @@ -133,6 +133,7 @@ export function getHtml(parsedReq: ParsedRequest) { function getImage(src: string, width ='auto', height = '225') { return `