ソースを参照

Add global seo configuration info

Raven 1 年間 前
コミット
db1ba5a503
4 ファイル変更50 行追加1 行削除
  1. 0 0
      docs/search_indexes.json
  2. 23 0
      docs/seo.html
  3. 1 1
      docs/slug.html
  4. 26 0
      docsrc/content/basics/seo.go

ファイルの差分が大きいため隠しています
+ 0 - 0
docs/search_indexes.json


+ 23 - 0
docs/seo.html

@@ -239,6 +239,16 @@ collection.RemoveSEO("Not Found")
 </code></pre>
 <h2><a name="configuration" class="anchor" href="#configuration" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
 Configuration</h2>
+<h3><a name="change-the-default-global-seo-name" class="anchor" href="#change-the-default-global-seo-name" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
+Change the default global SEO name</h3>
+
+<div class="highlight highlight-go"><pre>collection.SetGlobalName(&#34;My Global SEO&#34;)
+</pre></div>
+<h3><a name="change-the-default-context-db-key" class="anchor" href="#change-the-default-context-db-key" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
+Change the default context db key</h3>
+
+<div class="highlight highlight-go"><pre>collection.SetDBContextKey(&#34;My DB&#34;)
+</pre></div>
 <h3><a name="change-the-default-seo-name" class="anchor" href="#change-the-default-seo-name" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
 Change the default SEO name</h3>
 
@@ -280,6 +290,19 @@ Customization</h2>
 <p>You can customize your SEO settings by implementing the interface and adding functions such as l10n and publish.</p>
 
 <highlightjs :language='"go"' :code='"type QorSEOSettingInterface interface {\n\tGetName() string\n\tSetName(string)\n\tGetSEOSetting() Setting\n\tSetSEOSetting(Setting)\n\tGetVariables() Variables\n\tSetVariables(Variables)\n\tGetTitle() string\n\tGetDescription() string\n\tGetKeywords() string\n\tGetOpenGraphURL() string\n\tGetOpenGraphType() string\n\tGetOpenGraphImageURL() string\n\tGetOpenGraphImageFromMediaLibrary() media_library.MediaBox\n\tGetOpenGraphMetadata() []OpenGraphMetadata\n}\n"'></highlightjs>
+<p>Suppose <code>QorSEOSetting</code> implemented the above interface</p>
+
+<div class="highlight highlight-go"><pre>type MySEOSetting struct{
+		QorSEOSetting
+		// publish
+		// l10n
+}
+</pre></div>
+
+<p>Use <code>SetSettingModel</code> function to set it</p>
+
+<div class="highlight highlight-go"><pre>collection.SetSettingModel(&amp;MySEOSetting{})
+</pre></div>
 
 <h2>Example</h2>
 

+ 1 - 1
docs/slug.html

@@ -209,7 +209,7 @@
 <h2><a name="usage" class="anchor" href="#usage" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
 Usage</h2>
 
-<p>If the source field called <code>Name</code>, then use <code>*WithSlug</code> which is <code>NameWithSlug</code> as the slug field name, the field type should be <code>slug.Slug</code></p>
+<p>If the source field called <code>Name</code>, Use <code>*WithSlug</code> which is <code>NameWithSlug</code> as the slug field name, the field type should be <code>slug.Slug</code>. Then the pretty URL would be derived from <code>Name</code> automatically on editing.</p>
 
 <div class="highlight highlight-go"><pre>
 type User struct {

+ 26 - 0
docsrc/content/basics/seo.go

@@ -43,6 +43,17 @@ collection.RemoveSEO("Not Found")
 
 ## Configuration
 
+### Change the default global SEO name
+~~~go
+collection.SetGlobalName("My Global SEO")
+~~~
+
+
+### Change the default context db key
+~~~go
+collection.SetDBContextKey("My DB")
+~~~
+
 ### Change the default SEO name
 ~~~go
 collection.RegisterSEO(&Product{}).SetName("My Product")
@@ -86,6 +97,21 @@ collection.Render(Product{}, request)
 You can customize your SEO settings by implementing the interface and adding functions such as l10n and publish.`),
 	ch.Code(generated.QorSEOSettingInterface).Language("go"),
 
+	Markdown(`
+Suppose ~~MySEOSetting~~ implemented the above interface
+~~~go
+type MySEOSetting struct{
+		QorSEOSetting
+		// publish
+		// l10n
+}
+~~~
+
+Use ~~SetSettingModel~~ function to set it
+~~~go
+collection.SetSettingModel(&MySEOSetting{})
+~~~`),
+
 	htmlgo.H2("Example"),
 	ch.Code(generated.SeoExample).Language("go"),
 

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません