mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
13 lines
14 KiB
JavaScript
13 lines
14 KiB
JavaScript
import{B as e,P as t,_ as n,f as r,g as i,h as a,l as o}from"./runtime-core.esm-bundler-CZvn3YaB.js";import{t as s}from"./plugin-vue_export-helper-CxTVcLa7.js";var c=JSON.parse(`{"path":"/en/guide/seo/","title":"SEO | Guide","lang":"en-US","frontmatter":{"title":"SEO","icon":"tabler:seo","createTime":"2025/10/08 14:46:25","permalink":"/en/guide/seo/","description":"Usage The theme provides out-of-the-box configuration to enable SEO optimization features for your site. To enable it, configure the following: .vuepress/config.ts For custom SE...","head":[["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"SEO\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2025-10-09T07:46:05.000Z\\",\\"author\\":[]}"],["meta",{"property":"og:url","content":"https://theme-plume.vuejs.press/en/guide/seo/"}],["meta",{"property":"og:site_name","content":"Plume Theme"}],["meta",{"property":"og:title","content":"SEO"}],["meta",{"property":"og:description","content":"Usage The theme provides out-of-the-box configuration to enable SEO optimization features for your site. To enable it, configure the following: .vuepress/config.ts For custom SE..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2025-10-09T07:46:05.000Z"}],["meta",{"property":"article:modified_time","content":"2025-10-09T07:46:05.000Z"}],["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://theme-plume.vuejs.press/guide/seo/"}]]},"readingTime":{"minutes":1.6,"words":480},"git":{"createdTime":1759995965000,"updatedTime":1759995965000,"contributors":[{"name":"pengzhanbo","username":"pengzhanbo","email":"volodymyr@foxmail.com","commits":1,"avatar":"https://avatars.githubusercontent.com/pengzhanbo?v=4","url":"https://github.com/pengzhanbo"}],"changelog":[{"hash":"385059f214cb07fc9a098859e889432fb81f998b","time":1759995965000,"email":"volodymyr@foxmail.com","author":"pengzhanbo","message":"docs: update en docs (#708)"}]},"autoDesc":true,"filePathRelative":"en/guide/features/seo.md","headers":[],"bulletin":false}`),l={name:`seo.md`},u={class:`code-block-title`,"data-title":`.vuepress/config.ts`},d={class:`code-block-title-bar`},f={class:`title`},p={class:`code-block-title`,"data-title":`.vuepress/config.ts`},m={class:`code-block-title-bar`},h={class:`title`};function g(s,c,l,g,_,v){let y=e(`VPIcon`);return t(),r(`div`,null,[c[4]||=o(`h2`,{id:`usage`,tabindex:`-1`},[o(`a`,{class:`header-anchor`,href:`#usage`},[o(`span`,null,`Usage`)])],-1),c[5]||=o(`p`,null,`The theme provides out-of-the-box configuration to enable SEO optimization features for your site. To enable it, configure the following:`,-1),o(`div`,u,[o(`div`,d,[o(`span`,f,[n(y,{provider:`iconify`,name:`vscode-icons:file-type-typescript`}),c[0]||=i(`.vuepress/config.ts`,-1)])]),c[1]||=a(`<div class="language-ts" data-highlighter="shiki" data-ext="ts" style="--shiki-light:#393a34;--shiki-dark:#dbd7caee;--shiki-light-bg:#ffffff;--shiki-dark-bg:#121212;"><pre class="shiki shiki-themes vitesse-light vitesse-dark vp-code"><code class="language-ts"><span class="line"><span style="--shiki-light:#1E754F;--shiki-dark:#4D9375;">export</span><span style="--shiki-light:#1E754F;--shiki-dark:#4D9375;"> default</span><span style="--shiki-light:#59873A;--shiki-dark:#80A665;"> defineUserConfig</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">({</span></span>
|
|
<span class="line"><span style="--shiki-light:#998418;--shiki-dark:#B8A965;"> theme</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">: </span><span style="--shiki-light:#59873A;--shiki-dark:#80A665;">plumeTheme</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">({</span></span>
|
|
<span class="line"><span style="--shiki-light:#998418;--shiki-dark:#B8A965;"> hostname</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">: </span><span style="--shiki-light:#B5695977;--shiki-dark:#C98A7D77;">'</span><span style="--shiki-light:#B56959;--shiki-dark:#C98A7D;">http://your_site_url</span><span style="--shiki-light:#B5695977;--shiki-dark:#C98A7D77;">'</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">,</span></span>
|
|
<span class="line"><span style="--shiki-light:#999999;--shiki-dark:#666666;"> })</span></span>
|
|
<span class="line"><span style="--shiki-light:#999999;--shiki-dark:#666666;">})</span></span></code></pre></div>`,1)]),c[6]||=o(`p`,null,[i(`For custom SEO optimization, you can configure it through `),o(`code`,null,`plugins.seo`),i(`:`)],-1),o(`div`,p,[o(`div`,m,[o(`span`,h,[n(y,{provider:`iconify`,name:`vscode-icons:file-type-typescript`}),c[2]||=i(`.vuepress/config.ts`,-1)])]),c[3]||=a(`<div class="language-ts" data-highlighter="shiki" data-ext="ts" style="--shiki-light:#393a34;--shiki-dark:#dbd7caee;--shiki-light-bg:#ffffff;--shiki-dark-bg:#121212;"><pre class="shiki shiki-themes vitesse-light vitesse-dark vp-code"><code class="language-ts"><span class="line"><span style="--shiki-light:#1E754F;--shiki-dark:#4D9375;">export</span><span style="--shiki-light:#1E754F;--shiki-dark:#4D9375;"> default</span><span style="--shiki-light:#59873A;--shiki-dark:#80A665;"> defineUserConfig</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">({</span></span>
|
|
<span class="line"><span style="--shiki-light:#998418;--shiki-dark:#B8A965;"> theme</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">: </span><span style="--shiki-light:#59873A;--shiki-dark:#80A665;">plumeTheme</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">({</span></span>
|
|
<span class="line"><span style="--shiki-light:#998418;--shiki-dark:#B8A965;"> plugins</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">: {</span></span>
|
|
<span class="line"><span style="--shiki-light:#998418;--shiki-dark:#B8A965;"> seo</span><span style="--shiki-light:#999999;--shiki-dark:#666666;">: {</span></span>
|
|
<span class="line"><span style="--shiki-light:#A0ADA0;--shiki-dark:#758575DD;"> // ... SEO configuration</span></span>
|
|
<span class="line"><span style="--shiki-light:#999999;--shiki-dark:#666666;"> }</span></span>
|
|
<span class="line"><span style="--shiki-light:#999999;--shiki-dark:#666666;"> }</span></span>
|
|
<span class="line"><span style="--shiki-light:#999999;--shiki-dark:#666666;"> })</span></span>
|
|
<span class="line"><span style="--shiki-light:#999999;--shiki-dark:#666666;">})</span></span></code></pre></div>`,1)]),c[7]||=a(`<p>For complete configuration options, please refer to the <a href="https://ecosystem.vuejs.press/en/plugins/seo/seo/config.html" target="_blank" rel="noopener noreferrer">documentation</a>.</p><div class="hint-container note"><p class="hint-container-title">Note</p><p>This example is forked from <a href="https://ecosystem.vuejs.press/en/plugins/seo/seo/" target="_blank" rel="noopener noreferrer">@vuepress/plugin-seo</a>, licensed under <a href="https://github.com/vuepress/ecosystem/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">MIT</a>.</p></div><h2 id="guide" tabindex="-1"><a class="header-anchor" href="#guide"><span>Guide</span></a></h2><p>The theme enhances your site's search engine optimization by injecting tags into the website's <code><head></code> section, making it fully compliant with the <a href="https://ogp.me/" target="_blank" rel="noopener noreferrer">Open Graph Protocol (OGP)</a> and <a href="https://www.w3.org/TR/json-ld-api/" target="_blank" rel="noopener noreferrer">JSON-LD 1.1</a>.</p><p>By default, the plugin reads site configuration, theme configuration, and page frontmatter to automatically generate metadata. Elements such as site name, page title, page type, writing date, last update date, and article tags are automatically generated.</p><h2 id="default-ogp-generation-logic" tabindex="-1"><a class="header-anchor" href="#default-ogp-generation-logic"><span>Default OGP Generation Logic</span></a></h2><table><thead><tr><th style="text-align:left;">Property Name</th><th style="text-align:left;">Value</th></tr></thead><tbody><tr><td style="text-align:left;"><code>og:url</code></td><td style="text-align:left;"><code>options.hostname</code> + <code>path</code></td></tr><tr><td style="text-align:left;"><code>og:site_name</code></td><td style="text-align:left;"><code>siteConfig.title</code></td></tr><tr><td style="text-align:left;"><code>og:title</code></td><td style="text-align:left;"><code>page.title</code></td></tr><tr><td style="text-align:left;"><code>og:description</code></td><td style="text-align:left;"><code>page.frontmatter.description</code> || auto-generated (when <code>autoDescription</code> is <code>true</code> in plugin options)</td></tr><tr><td style="text-align:left;"><code>og:type</code></td><td style="text-align:left;"><code>"article"</code></td></tr><tr><td style="text-align:left;"><code>og:image</code></td><td style="text-align:left;"><code>options.hostname</code> + <code>page.frontmatter.image</code> || first image in page || <code>fallbackImage</code> from plugin options</td></tr><tr><td style="text-align:left;"><code>og:updated_time</code></td><td style="text-align:left;"><code>page.git.updatedTime</code></td></tr><tr><td style="text-align:left;"><code>og:locale</code></td><td style="text-align:left;"><code>page.lang</code></td></tr><tr><td style="text-align:left;"><code>og:locale:alternate</code></td><td style="text-align:left;">Other languages included in <code>siteData.locales</code></td></tr><tr><td style="text-align:left;"><code>twitter:card</code></td><td style="text-align:left;"><code>"summary_large_image"</code> (only when image is found)</td></tr><tr><td style="text-align:left;"><code>twitter:image:alt</code></td><td style="text-align:left;"><code>page.title</code> (only when image is found)</td></tr><tr><td style="text-align:left;"><code>article:author</code></td><td style="text-align:left;"><code>page.frontmatter.author</code> || <code>options.author</code></td></tr><tr><td style="text-align:left;"><code>article:tag</code></td><td style="text-align:left;"><code>page.frontmatter.tags</code> || <code>page.frontmatter.tag</code></td></tr><tr><td style="text-align:left;"><code>article:published_time</code></td><td style="text-align:left;"><code>page.frontmatter.date</code> || <code>page.git.createdTime</code></td></tr><tr><td style="text-align:left;"><code>article:modified_time</code></td><td style="text-align:left;"><code>page.git.updatedTime</code></td></tr></tbody></table><h2 id="default-json-ld-generation-logic" tabindex="-1"><a class="header-anchor" href="#default-json-ld-generation-logic"><span>Default JSON-LD Generation Logic</span></a></h2><table><thead><tr><th style="text-align:left;">Property Name</th><th style="text-align:left;">Value</th></tr></thead><tbody><tr><td style="text-align:left;"><code>@context</code></td><td style="text-align:left;"><code>"https://schema.org"</code></td></tr><tr><td style="text-align:left;"><code>@type</code></td><td style="text-align:left;"><code>"NewsArticle"</code></td></tr><tr><td style="text-align:left;"><code>headline</code></td><td style="text-align:left;"><code>page.title</code></td></tr><tr><td style="text-align:left;"><code>image</code></td><td style="text-align:left;">Images in page || <code>options.hostname</code> + <code>page.frontmatter.image</code></td></tr><tr><td style="text-align:left;"><code>datePublished</code></td><td style="text-align:left;"><code>page.frontmatter.date</code> || <code>page.git.createdTime</code></td></tr><tr><td style="text-align:left;"><code>dateModified</code></td><td style="text-align:left;"><code>page.git.updatedTime</code></td></tr><tr><td style="text-align:left;"><code>author</code></td><td style="text-align:left;"><code>page.frontmatter.author</code> || <code>options.author</code></td></tr></tbody></table><h2 id="seo-introduction" tabindex="-1"><a class="header-anchor" href="#seo-introduction"><span>SEO Introduction</span></a></h2><p>Search Engine Optimization (SEO) is a method of adjusting websites by understanding search engine operation rules to improve a target website's ranking in search engines. Since many studies have found that search engine users often only pay attention to the top few entries in search results, many websites hope to influence search engine rankings through various methods to achieve excellent search rankings for their sites.</p><p>The so-called "optimization for search engines" refers to making websites more easily accepted by search engines. Search engines compare the content between websites for relevance, and then browsers present this content to searchers in the fastest and most complete way possible. Search engine optimization follows search engine rules to create better user experiences, with the ultimate goal of providing excellent user experience.</p><h2 id="related-documentation" tabindex="-1"><a class="header-anchor" href="#related-documentation"><span>Related Documentation</span></a></h2><ul><li><p><a href="https://ogp.me/" target="_blank" rel="noopener noreferrer">Open Graph Protocol (OGP)</a></p><p>This plugin fully supports this protocol and automatically generates compliant <code><meta></code> tags.</p></li><li><p><a href="https://www.w3.org/TR/json-ld-api/" target="_blank" rel="noopener noreferrer">JSON-LD 1.1</a></p><p>This plugin generates NewsArticle type tags for article pages.</p></li><li><p><a href="https://www.w3.org/TR/rdfa-primer/" target="_blank" rel="noopener noreferrer">RDFa 1.1</a></p><p>RDFa primarily marks up HTML structure.</p></li><li><p><a href="https://schema.org/" target="_blank" rel="noopener noreferrer">Schema.Org</a></p><p>Schema definitions for structured markup sites.</p></li></ul>`,14)])}var _=s(l,[[`render`,g]]);export{c as _pageData,_ as default}; |