HEXOブログの場合...メタ記述は設定ファイルに書かれており、すべてのページで動作します。「タグ」と「カテゴリ」ページのメタ記述
blogpostsについては、個別のメタディスクリプションを作成することができます。これは検索エンジンで機能します。
しかし、私の "タグ"と "カテゴリ"ページは、現在、ホームページのメタ記述で索引付けされています。 これは良くありません。
「タグ」と「カテゴリ」ページのカスタムメタデータ記述を作成できるかどうかを尋ねていますか?これは私のhead.ejs
のコードである description: this is a page about {{tag}}
と
description: this is a page about {{category}}
何かのように...。 サイトのメイン設定ファイルはdescription: main config meta-description text
です。
<%if(metaDescription){%>
<meta name="description" content="<%= config.description %>">
<% } else if (page.description){ %>
<meta name="description" content="<%= page.description %>">
<% } else if (page.excerpt){ %>
<meta name="description" content="<%= strip_html(page.excerpt).replace(/^\s*/, '').replace(/\s*$/, '').replace(/[\n,\r]/g,'') %>">
<% } else if (page.content){ %>
<meta name="description" content="<%= strip_html(page.content).replace(/^\s*/, '').replace(/\s*$/, '').substring(0, 150).replace(/[\n,\r]/g,'') %>">
<% } else if (config.description){ %>
<meta name="description" content="<%= config.description %>">
<% }
<% if (page.keywords){ %>
<meta name="keywords" content="<%= page.keywords %>">
<% } else if (page.tags){ %>
<%
var thistags=[];
page.tags.each(function(k){
thistags.push(k.name);
}) %>
<meta name="keywords" content="<%= thistags %>">
<% } %>
こんにちはに基づきます..私はすでにあなたのブログからたくさんのことを学びました... http://www.codeblocq.com/2016/03/Create-an-Hexo-Theme-Part-1-Index/ - ここにもお会いできてうれしいです... :)説明については意味がありますが、これを正確に実装する場所はどこですか?私は投稿概要ページを持っており、これは 'archive.ejs'、私の' tags'ページからロジックを受け取り、 'categories'ページも私の' archive.ejs'パーシャルのロジックを取ると仮定して、上のコードを追加します'archieve.ejs'?また、メインの 'config'ファイルに設定しているので、デフォルトの' meta-description'はNON-tagとNON-categoryではまだ動作していますか? – raulbaros
メタ記述が設定から来たら、完璧です。ロジックの残りの部分は、必要な場所に実装する必要があります。おそらく 'head.ejs'などです。 – klugjo
、ありがとう! – raulbaros