Improve SEO (#76)

This commit is contained in:
Steven 2019-04-21 20:54:13 -04:00 committed by GitHub
parent d01b8e0d93
commit 7e72d518b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 4 deletions

View File

@ -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" }
]

View File

@ -1,11 +1,12 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="og:image" content="https://og-image.now.sh/Open%20Graph%20Image%20as%20a%20Service.png" />
<title>Open Graph Image as a Service</title>
<meta name="description" content="A service to generate dynamic Open Graph images on-the-fly for the purpose of sharing a website to social media. Proudly hosted on ZEIT Now." />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="style.css" />
</head>

1
public/robots.txt Normal file
View File

@ -0,0 +1 @@
User-agent: *

View File

@ -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 }
)
);
}

View File

@ -133,6 +133,7 @@ export function getHtml(parsedReq: ParsedRequest) {
function getImage(src: string, width ='auto', height = '225') {
return `<img
class="logo"
alt="Generated Image"
src="${sanitizeHtml(src)}"
width="${sanitizeHtml(width)}"
height="${sanitizeHtml(height)}"