{"id":9901,"date":"2019-04-01T06:40:44","date_gmt":"2019-03-31T21:40:44","guid":{"rendered":"https:\/\/www.suzukikenichi.com\/blog\/?p=9901"},"modified":"2019-04-07T06:34:17","modified_gmt":"2019-04-06T21:34:17","slug":"switch-to-hisroty-mode-and-enable-vue-meta","status":"publish","type":"post","link":"https:\/\/www.suzukikenichi.com\/blog\/switch-to-hisroty-mode-and-enable-vue-meta\/","title":{"rendered":"\u3010JavaScript SEO\u3011Vue\u3067\u306fvue-router\u3092history\u30e2\u30fc\u30c9\u3078\u5909\u66f4\u3001vue-meta\u3092\u6709\u52b9\u306b"},"content":{"rendered":"<p class=\"p20-b al-r small\">[\u30ec\u30d9\u30eb: \u4e0a\u7d1a]<\/p>\n<p>\u30e1\u30b8\u30e3\u30fc\u306a JavaScript \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3042\u308b\u3001<a href=\"https:\/\/www.suzukikenichi.com\/blog\/you-can-use-angular-react-and-vue-for-google-seo\/\">Angular\u30fbReact\u30fbVue \u306f Google \u691c\u7d22\u306e SEO \u306b\u304a\u3044\u3066\u57fa\u672c\u7684\u306b\u306f\u3046\u307e\u304f\u6a5f\u80fd\u3059\u308b<\/a>\u3053\u3068\u3092\u3001\u5148\u65e5\u304a\u4f1d\u3048\u3057\u307e\u3057\u305f\u3002<\/p>\n<p class=\"p60-b\">\u305f\u3060\u3057\u3001\u691c\u7d22\u30a8\u30f3\u30b8\u30f3\u30d5\u30ec\u30f3\u30c9\u30ea\u30fc\u306b\u3059\u308b\u305f\u3081\u306b\u4e00\u90e8\u306e\u5909\u66f4\u304c\u5fc5\u9808\u3067\u3059\u3002<br \/>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u5909\u66f4\u306e\u305f\u3081\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h2>Vue.js \u306e SEO \u69cb\u6210<\/h2>\n<p>\u524d\u56de\u306e\u8a18\u4e8b\u3067\u3001\u300cVue.js \u3067\u306f vue-router \u3092\u7121\u52b9\u306b\u3059\u308b\u300d\u306a\u3069\u3068\u30c8\u30f3\u30c1\u30f3\u30ab\u30f3\u306a\u3053\u3068\u3092\u66f8\u3044\u3066\u3057\u307e\u3044\u307e\u3057\u305f\uff08\u52d8\u9055\u3044\u3055\u305b\u3066\u3057\u307e\u3044\u3001\u7533\u3057\u8a33\u3042\u308a\u307e\u305b\u3093\u3002\u554f\u984c\u7b87\u6240\u306f\u4fee\u6b63\u6e08\u307f\u3067\u3059\uff09\u3002<br \/>\u6b63\u3057\u304f\u306f\u3001hash \u30e2\u30fc\u30c9\u304b\u3089 history \u30e2\u30fc\u30c9\u3078\u306e\u5909\u66f4\u3067\u3059\uff08\u3053\u308c\u306a\u3089\u30011\u884c\u306e\u5909\u66f4\u3067\u6e08\u307f\u307e\u3059\u306d\uff09\u3002<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e hash \u30e2\u30fc\u30c9\u3060\u3068 <a href=\"https:\/\/www.suzukikenichi.com\/blog\/do-not-use-hash-in-urls\/\">URL \u306b # \u3092\u4f7f\u3046\u306e\u3067 SEO \u306b\u4e0d\u5411\u304d<\/a>\u3067\u3059\u3002<br \/>historyAPI \u3092\u9069\u7528\u3057\u3066\u4e00\u610f\u306e URL \u3092\u5272\u308a\u5f53\u3066\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p class=\"p30-b\">\u307e\u305f\u3001 Vue \u3067\u306f title \u30bf\u30b0\u3068 meta description \u30bf\u30b0\u3092\u6271\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b vue-meta \u306e\u62e1\u5f35\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30fc\u30c9\u4f8b\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>vue-meta \u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002<br \/>\u305d\u3057\u3066 history \u30e2\u30fc\u30c9\u306b\u5207\u308a\u66ff\u3048\u307e\u3059\u3002<\/p>\n<pre style=\"overflow-x: auto\"><code class=\"green\">import Meta from 'vue-meta' \/\/vue-meta \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\nVue.use(Meta)\r\n\r\nconst router = VueRouter({\r\n mode: 'history', \/\/history \u30e2\u30fc\u30c9\u306b\u5909\u66f4\r\n routes\r\n})<\/code><\/pre>\n<p class=\"p30-t\">title \u30bf\u30b0\u3068 meta description \u30bf\u30b0\u3092\u69cb\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"p40-b\">\n<pre style=\"overflow-x: auto\"><code class=\"green\">export default {\r\n meta info() {\r\n  return {\r\n   title: \/* title \u30bf\u30b0\u3092\u8a18\u8ff0 *\/,\r\n   meta: [\r\n    {name: 'description', conent: \/* meta description \u30bf\u30b0\u3092\u8a18\u8ff0 *\/}\r\n   ]\r\n  }\r\n },\r\n\/\/...\r\n}<\/code><\/pre>\n<\/div>\n<h2>React \u306e SEO \u69cb\u6210<\/h2>\n<p>Vue \u540c\u69d8\u306b React \u3067\u3082 title \u30bf\u30b0\u3068 meta description \u30bf\u30b0\u3092\u69cb\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\u305d\u306e\u305f\u3081\u306b react-helmet \u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30fc\u30c9\u306e\u30b5\u30f3\u30d7\u30eb\u4f8b\u3067\u3059\u3002<\/p>\n<div class=\"p40-b\">\n<pre style=\"overflow-x: auto\"><code class=\"green\">import {Helmet} from 'react-helmet' \/\/react-helmet \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\nexport class SomePage extends Component {\r\n \/\/...\r\n render() {\r\n  return (&lt;div&gt;\r\n   \/\/...\r\n    &lt;Helmet&gt;\r\n     &lt;title&gt;{\/* title \u30bf\u30b0\u3092\u8a18\u8ff0 *\/}&lt;\/title&gt;\r\n     &lt;meta name='description' content={\/*  meta description \u30bf\u30b0\u3092\u8a18\u8ff0 *\/} \/&gt;\r\n    &lt;\/Helmet&gt;\r\n   &lt;\/div&gt;)\r\n  }\r\n}<\/code><\/pre>\n<\/div>\n<h2>Angular \u306e SEO \u69cb\u6210<\/h2>\n<p>Angular \u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u3001title \u30bf\u30b0\u304a\u3088\u3073 meta description \u30bf\u30b0\u3092\u69cb\u6210\u3067\u304d\u307e\u3059\u3002<br \/>Vue \u3084 React \u3068\u306f\u7570\u306a\u308a\u3001\u62e1\u5f35\u6a5f\u80fd\u3092\u5225\u9014\u6709\u52b9\u306b\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<div class=\"p60-b\">\n<pre style=\"overflow-x: auto\"><code class=\"green\">import {Title , Meta} from '@angular\/platform-browser';\r\n\r\nexport class SomePageComponent implements OnInit {\r\n constructor(private title: Title, private meta: Meta) { }\r\n ngOnInit() {\r\n this.title.setTitle(\/* title \u30bf\u30b0\u3092\u8a18\u8ff0 *\/);\r\n this.meta.updateTag({\r\n  name: 'description' , content: \/*  meta description \u30bf\u30b0\u3092\u8a18\u8ff0 *\/\r\n  });\r\n }\r\n}<\/code><\/pre>\n<\/div>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u30b3\u30fc\u30c9\u306f\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<br \/>\u5b9f\u969b\u306b\u306f\u3001\u74b0\u5883\u306b\u5fdc\u3058\u3066\u5909\u308f\u3063\u3066\u304f\u308b\u90e8\u5206\u3082\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\u8a73\u7d30\u306f\u3001\u305d\u308c\u305e\u308c\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u6280\u8853\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\uff08\u305d\u308c\u3067\u3082\u9593\u9055\u3063\u3066\u306a\u3044\u306f\u305a\u3067\u3059\u3002\u3082\u3057\u4e07\u304c\u4e00\u3001\u304a\u304b\u3057\u306a\u3068\u3053\u308d\u304c\u3042\u308c\u3070\u6307\u6458\u3057\u3066\u304f\u3060\u3055\u3044\uff09\u3002<\/p>\n<p>\u8cea\u554f\u306f\u50d5\u3067\u306f\u306a\u304f<a href=\"https:\/\/twitter.com\/g33konaut\">\u30de\u30fc\u30c6\u30a3\u30f3\u3078<\/a>\u3069\u3046\u305e\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30e1\u30b8\u30e3\u30fc\u306a JavaScript \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3042\u308b\u3001Angular\u30fbReact\u30fbVue \u306f Google \u691c\u7d22\u306e SEO \u306b\u304a\u3044\u3066\u57fa\u672c\u7684\u306b\u306f\u3046\u307e\u304f\u6a5f\u80fd\u3059\u308b\u3002\u305f\u3060\u3057\u3001\u691c\u7d22\u30a8\u30f3\u30b8\u30f3\u30d5\u30ec\u30f3\u30c9\u30ea\u30fc\u306b\u3059\u308b\u305f\u3081\u306b\u4e00\u90e8\u306e\u5909\u66f4\u304c\u5fc5\u9808\u3002Vue \u3067\u306f vue-meta \u3092\u6709\u52b9\u306b\u3057\u3001\u307e\u305f history \u30e2\u30fc\u30c9\u306b\u5207\u308a\u66ff\u3048\u308b\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[578],"class_list":["post-9901","post","type-post","status-publish","format-standard","category-google-seo","tag-javascript"],"_links":{"self":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/posts\/9901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/comments?post=9901"}],"version-history":[{"count":0,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/posts\/9901\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/media?parent=9901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/categories?post=9901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/tags?post=9901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}