Tutorial HTML <meta>
Element HTML
meta
digunakan untuk menambahkan informasi atau fungsi tertentu yang ditujukan untuk pembacaan browser, mesin telusur web serta layanan web lainnya, dan tidak diperuntukkan kepada user atau pengunjung.<meta charset="utf-8"/>
Table of contents
Kategori Element
Element
<meta>
termasuk dalam kategori :Metadata content
flow content
,phrasing content
(Jika attributeitemprop
disematkan)
Catatan : Jika element
meta
tidak ada attribute itemprop
, maka penulisannya wajib ditulis didalam element <head>
Tag kelalaian (Tag omission) : Tag pembuka harus ada tapi tag penutup tidak boleh hadir, contoh penulisan :
<meta content='Deskripsi dokumen HTML' name="description"/>
<!-- atau -->
<meta content='Deskripsi dokumen HTML' name="description">
Attribute HTML <meta>
charset
Attribute ini digunakan untuk menentukan pengkodean karakter dokumen HTML. Nilai yang diberikan harus berdasarkan MIME standar pengkodean karakter, selengkapnya dapat dilihat pada tautan berikut ; IANA MIME standar untuk pengkodean karakter
Jenis pengkodeaan yang paling disarakan adalah UTF-8, contoh :
<meta charset="utf-8"/>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>Demo Triksonic</title> </head> <body> <p>Konten body</p> </body> </html>
content
Attribute ini digunakan untuk menentukan nilai yang terkait dengan attribute
http-equiv
dan attribute name
.Contoh :
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="deskripsi halaman" name="description">
<meta content="keyword 1,keyword 2,keyword 3" name="keywords">
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Demo Triksonic</title> <meta content="width=device-width, initial-scale=1" name="viewport"> <meta content="deskripsi halaman" name="description"> <meta content="keyword 1,keyword 2,keyword 3" name="keywords"> </head> <body> <p>Konten body</p> </body> </html>
http-equiv
Attribute ini digunakan untuk menentukan perintah yang dapat mengubah perilaku server dan user-agent. Nilai Perintah didefinisikan pada attribute
content
name
Attribute ini digunakan untuk menentukan nama dari metadata yang terkait dengan attribute
content
. Jika attribute itemprop
, http-equiv
dan charset
juga disebutkan, seharusnya attribute name
tidak diatur.scheme
Attibute ini digunakan untuk menentukan Skema yang digunakan untuk mengartikan atau menafsirkan attribute
content
Penting : Attribute ini tidak berlaku lagi pada HTML5, dianjurkan untuk tidak menerapkannya
Contoh Penulisan
<meta name="date" content="2010-11-12" scheme="YYYY-MM-DD">
Daftar Tag Meta
Berikut kumpulan tag meta yang bisa digunakan pada dokumen HTML, yang bersumber dari;
- https://gist.github.com/lancejpollard/1978404
- https://gist.github.com/kevinSuttle/1997924
- https://support.google.com/webmasters/answer/79812
Basic HTML Meta Tag
<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright" content="company name">
<meta name="language" content="ES">
<meta name="robots" content="index,follow" />
<meta name="revised" content="Sunday, July 18th, 2010, 5:15 pm" />
<meta name="abstract" content="">
<meta name="topic" content="">
<meta name="summary" content="">
<meta name="Classification" content="Business">
<meta name="author" content="name, email@hotmail.com">
<meta name="designer" content="">
<meta name="copyright" content="">
<meta name="reply-to" content="email@hotmail.com">
<meta name="owner" content="">
<meta name="url" content="http://www.websiteaddrress.com">
<meta name="identifier-URL" content="http://www.websiteaddress.com">
<meta name="directory" content="submission">
<meta name="category" content="">
<meta name="coverage" content="Worldwide">
<meta name="distribution" content="Global">
<meta name="rating" content="General">
<meta name="revisit-after" content="7 days">
<meta http-equiv="Expires" content="0"> <!-- no valid hTML5 -->
<meta http-equiv="Pragma" content="no-cache"> <!-- no valid hTML5 -->
<meta http-equiv="Cache-Control" content="no-cache"> <!-- no valid hTML5 -->
OpenGraph Meta Tag
<meta name="og:title" content="Tittle Document">
<meta name="og:type" content="movie">
<meta name="og:url" content="https://example.com/your-title">
<meta name="og:image" content="https://example.com/image.jpg">
<meta name="og:site_name" content="Site Name">
<meta name="og:description" content="Description Document">
<meta name="fb:page_id" content="0123456789">
<meta name="og:email" content="example@example.com">
<meta name="og:phone_number" content="012-345-678">
<meta name="og:fax_number" content="+00-123-456-789">
<meta name="og:latitude" content="12.34567">
<meta name="og:longitude" content="-1123.456789">
<meta name="og:street-address" content="Your Address">
<meta name="og:locality" content="Your locality">
<meta name="og:region" content="Your region">
<meta name="og:postal-code" content="123456">
<meta name="og:country-name" content="Your-country-name">
<meta property="og:type" content="game.achievement">
<meta property="og:points" content="POINTS_FOR_ACHIEVEMENT">
<meta property="og:video" content="http://example.com/awesome.swf">
<meta property="og:video:height" content="640">
<meta property="og:video:width" content="385">
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video" content="http://example.com/html5.mp4">
<meta property="og:video:type" content="video/mp4">
<meta property="og:video" content="http://example.com/fallback.vid">
<meta property="og:video:type" content="text/html">
<meta property="og:audio" content="http://example.com/amazing.mp3">
<meta property="og:audio:title" content="Amazing Song">
<meta property="og:audio:artist" content="Amazing Band">
<meta property="og:audio:album" content="Amazing Album">
<meta property="og:audio:type" content="application/mp3">
Custom Meta Tag
<meta name="google-analytics" content="asdfghjkl">
<meta name="disqus" content="asdfghjkl">
<meta name="uservoice" content="asdfghjkl">
<meta name="mixpanel" content="asdfghjkl">
ClaimID Meta Tag
<meta name="microid" content="mailto+http:sha1:asdfghjkl">
Apple Meta Tag
<meta name="apple-mobile-web-app-capable" content="yes">
<meta content="yes" name="apple-touch-fullscreen" />
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width = 320, initial-scale = 2.3, user-scalable = no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1.0">
Internet Explorer Meta Tag
<meta http-equiv="Page-Enter" content="RevealTrans(Duration=2.0,Transition=2)"> <!--no valid HTML5-->
<meta http-equiv="Page-Exit" content="RevealTrans(Duration=3.0,Transition=12)"> <!--no valid HTML5-->
<meta name="mssmarttagspreventparsing" content="true">
<meta content='IE=edge' http-equiv='X-UA-Compatible'>
<meta name="msapplication-starturl" content="http://example.com/about/">
<meta name="msapplication-window" content="width=800;height=600">
<meta name="msapplication-navbutton-color" content="red">
<meta name="application-name" content="Rey Bango Front-end Developer">
<meta name="msapplication-tooltip" content="Launch Rey Bango's Blog">
<meta name="msapplication-task" content="name=About;action-uri=/about/;icon-uri=/images/about.ico">
<meta name="msapplication-task" content="name=The Big List;action-uri=/the-big-list-of-javascript-css-and-html-development-tools-libraries-projects-and-books/;icon-uri=/images/list_links.ico">
<meta name="msapplication-task" content="name=jQuery Posts;action-uri=/category/jquery/;icon-uri=/images/jquery.ico">
<meta name="msapplication-task" content="name=Start Developing;action-uri=/category/javascript/;icon-uri=/images/script.ico">
Windows 8 Meta Tag
<meta name="application-name" content="Contoso">
<meta name="msapplication-TileColor" content="#009900">
<meta name="msapplication-square70x70logo" content="images/smalltile.png">
<meta name="msapplication-square150x150logo" content="images/mediumtile.png">
<meta name="msapplication-wide310x150logo" content="images/widetile.png">
<meta name="msapplication-square310x310logo" content="images/largetile.png">
<meta name="msapplication-notification" content="frequency=30; polling-uri=notifications/contoso1.xml;
polling-uri2=notifications/contoso2.xml; polling-uri3=notifications/contoso3.xml">
TweetMeme Meta Tag
<meta name="tweetmeme-title" content="Retweet Button Explained">
Blog Catalog Meta Tag
<meta name="blogcatalog" content="0123456789">
Rails Meta Tag
<meta name="csrf-param" content="authenticity_token">
<meta name="csrf-token" content="/bZVwvomkAnwAI1Qd37lFeewvpOIiackk9121fFwWwc=">
Tag meta yang dipahami oleh Google
Meta tags that Google understands
<meta charset="..." >
<meta name="description" content="A description of the page" />
<meta name="robots" content="..., ..." />
<meta name="googlebot" content="..., ..." />
<meta name="google" content="nositelinkssearchbox" />
<meta name="google" content="notranslate" />
<meta name="google-site-verification" content="..." />
<meta http-equiv="Content-Type" content="...; charset=..." />
<meta http-equiv="refresh" content="...;url=..." />
Global Attribute
Element <meta> mencakup Global Attributes HTML.
Browser Support HTML <meta>
Desktop
Chrome | Ya |
---|---|
Safari | Ya |
Firefox | 1 |
Opera | Ya |
IE | Ya |
Edge | Ya |
Mobile
Android webview | Ya |
---|---|
Chrome Android | Ya |
Edge mobile | Ya |
Firefox Android | 4 |
IE mobile | Ya |
Opera Android | Ya |
iOS Safari | Ya |
Table Info
- Nilai pada table menentukan versi minimal browser
Default CSS
Browser yang support dengan element
<meta>
, mempunyai nilai default :/* tidak ada */