2014-06-25 10:08:08 +00:00
|
|
|
---
|
2017-08-28 19:18:32 +00:00
|
|
|
title: HTML meta tags
|
2015-11-24 05:02:17 +00:00
|
|
|
category: HTML
|
2020-07-04 13:33:09 +00:00
|
|
|
updated: 2020-03-20
|
2017-08-30 06:52:12 +00:00
|
|
|
weight: -3
|
2014-06-25 10:08:08 +00:00
|
|
|
---
|
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
### Meta tags
|
|
|
|
|
2015-01-28 01:01:00 +00:00
|
|
|
```html
|
|
|
|
<meta charset='utf-8'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2015-01-28 01:01:00 +00:00
|
|
|
<!-- title -->
|
2017-08-28 20:53:48 +00:00
|
|
|
<title>···</title>
|
|
|
|
<meta property='og:title' content='···'>
|
|
|
|
<meta name='twitter:title' content='···'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2017-08-28 20:53:48 +00:00
|
|
|
{: data-line="2"}
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2015-01-28 01:01:00 +00:00
|
|
|
<!-- url -->
|
2017-08-28 20:53:48 +00:00
|
|
|
<link rel='canonical' href='http://···'>
|
|
|
|
<meta property='og:url' content='http://···'>
|
|
|
|
<meta name='twitter:url' content='http://···'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2017-08-28 20:53:48 +00:00
|
|
|
{: data-line="2"}
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2017-08-28 20:53:48 +00:00
|
|
|
<!-- description -->
|
|
|
|
<meta name='description' content='···'>
|
|
|
|
<meta property='og:description' content='···'>
|
|
|
|
<meta name='twitter:description' content='···'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2017-08-28 20:53:48 +00:00
|
|
|
{: data-line="2"}
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2015-01-28 01:01:00 +00:00
|
|
|
<!-- image -->
|
2017-08-28 20:53:48 +00:00
|
|
|
<meta property="og:image" content="http://···">
|
|
|
|
<meta name="twitter:image" content="http://···">
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2015-01-28 01:01:00 +00:00
|
|
|
<!-- ua -->
|
|
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2015-01-28 01:01:00 +00:00
|
|
|
<!-- viewport -->
|
|
|
|
<meta name='viewport' content='width=device-width'>
|
|
|
|
<meta name='viewport' content='width=1024'>
|
|
|
|
```
|
|
|
|
|
|
|
|
### More opengraph
|
|
|
|
|
|
|
|
```html
|
2017-08-28 20:53:48 +00:00
|
|
|
<meta property='og:site_name' content='···'>
|
|
|
|
<meta property='og:type' content='website'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2017-08-28 20:53:48 +00:00
|
|
|
<meta property='fb:app_id' content='···'>
|
|
|
|
<meta property='fb:admins' content='UID1,UID2'>
|
|
|
|
<!-- ···unless there's app_id -->
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2015-01-28 01:01:00 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2017-08-28 20:53:48 +00:00
|
|
|
<meta property='og:audio' content='http://···/theme.mp3'>
|
|
|
|
<meta property='og:video' content='http://···/trailer.swf'>
|
2015-01-28 01:01:00 +00:00
|
|
|
```
|
|
|
|
|
2017-08-28 20:53:48 +00:00
|
|
|
See: [OpenGraph protocol](https://developers.facebook.com/docs/opengraphprotocol/) _(developers.facebook.com)_
|
|
|
|
|
2015-01-28 01:01:00 +00:00
|
|
|
### Opengraph for articles
|
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
- `article:published_time`
|
|
|
|
- `article:modified_time`
|
|
|
|
- `article:expiration_time`
|
|
|
|
- `article:author`
|
|
|
|
- `article:section`
|
|
|
|
- `article:tag`
|
2014-06-25 10:08:08 +00:00
|
|
|
|
2017-03-29 08:35:24 +00:00
|
|
|
### Apple-only
|
2015-02-06 09:41:03 +00:00
|
|
|
|
|
|
|
```html
|
2017-03-29 08:35:24 +00:00
|
|
|
<meta name='format-detection' content='telephone=no'>
|
2015-02-06 09:41:03 +00:00
|
|
|
```
|
|
|
|
|
2017-03-29 08:35:24 +00:00
|
|
|
## Progressive web apps
|
|
|
|
|
|
|
|
### Add to homescreen
|
2017-03-14 05:41:29 +00:00
|
|
|
|
|
|
|
```html
|
2017-03-29 08:35:24 +00:00
|
|
|
<meta name='mobile-web-app-capable' content='yes'>
|
|
|
|
<meta name='apple-mobile-web-app-capable' content='yes'>
|
2017-03-14 05:41:29 +00:00
|
|
|
```
|
|
|
|
|
2017-08-28 20:53:48 +00:00
|
|
|
```html
|
|
|
|
<meta name='apple-mobile-web-app-status-bar-style' content='black'>
|
|
|
|
<!-- black | black-translucent | default -->
|
|
|
|
```
|
|
|
|
|
|
|
|
### Theme color
|
2017-03-29 08:35:24 +00:00
|
|
|
|
|
|
|
```html
|
|
|
|
<meta name='theme-color' content='#ff00ff'>
|
|
|
|
```
|
|
|
|
|
2017-08-28 20:53:48 +00:00
|
|
|
Android-only.
|
|
|
|
See: [Theme color](https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android)
|
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
### Manifest
|
2017-03-29 08:35:24 +00:00
|
|
|
|
|
|
|
```html
|
|
|
|
<link rel='manifest' href='/manifest.json'>
|
|
|
|
```
|
|
|
|
|
2017-08-28 20:53:48 +00:00
|
|
|
Android-only.
|
2017-08-28 17:25:55 +00:00
|
|
|
See: [Manifest](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/)
|
|
|
|
|
|
|
|
### Icons
|
2017-03-14 05:41:29 +00:00
|
|
|
|
|
|
|
```html
|
2017-03-29 08:35:24 +00:00
|
|
|
<!-- Minimal -->
|
|
|
|
<link rel='icon' type='image/png' href='favicon@32.png'>
|
|
|
|
<link rel='icon' sizes='192x192' href='icon@192.png'>
|
|
|
|
<link rel='apple-touch-icon' href='icon@152.png'>
|
|
|
|
<meta name='msapplication-square310x310logo' content='icon@310.png'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2017-03-29 08:35:24 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2017-03-29 08:35:24 +00:00
|
|
|
<!-- Apple -->
|
|
|
|
<link rel='apple-touch-icon' href='touch-icon-iphone.png'>
|
|
|
|
<link rel='apple-touch-icon' sizes='76x76' href='touch-icon-ipad.png'>
|
|
|
|
<link rel='apple-touch-icon' sizes='120x120' href='touch-icon-iphone-retina.png'>
|
|
|
|
<link rel='apple-touch-icon' sizes='152x152' href='touch-icon-ipad-retina.png'>
|
2017-08-28 17:25:55 +00:00
|
|
|
```
|
2017-03-29 08:35:24 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
```html
|
2017-03-29 08:35:24 +00:00
|
|
|
<!-- Microsoft -->
|
|
|
|
<meta name='msapplication-square70x70logo' content='icon_smalltile.png'>
|
|
|
|
<meta name='msapplication-square150x150logo' content='icon_mediumtile.png'>
|
|
|
|
<meta name='msapplication-wide310x150logo' content='icon_widetile.png'>
|
2017-03-14 05:41:29 +00:00
|
|
|
```
|
|
|
|
|
2017-03-29 08:35:24 +00:00
|
|
|
Chrome on Android recommends [192x192](https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android).
|
2017-08-28 17:25:55 +00:00
|
|
|
See: [Icons](https://developers.google.com/web/fundamentals/design-and-ui/browser-customization/)
|
2017-03-29 08:35:24 +00:00
|
|
|
|
2017-08-28 17:25:55 +00:00
|
|
|
## Reference
|
|
|
|
{: .-one-column}
|
2014-06-25 10:08:08 +00:00
|
|
|
|
2020-03-19 17:35:03 +00:00
|
|
|
* <https://dev.twitter.com/cards>
|
2017-03-29 08:35:24 +00:00
|
|
|
* <https://developers.facebook.com/docs/opengraphprotocol/#types>
|
2017-08-28 17:25:55 +00:00
|
|
|
{: .-also-see}
|