|
@@ -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>Initialize a <code>Collection</code> instance and register global seo configuration. The <code>Collection</code> manages SEO of all the registered models and hold global seo settings</p>
|
|
|
+<p>Initialize a <code>Collection</code> instance. The <code>Collection</code> manages all the registered models and hold global seo settings</p>
|
|
|
|
|
|
<div class="highlight highlight-go"><pre>collection := seo.NewCollection()
|
|
|
|
|
@@ -259,6 +259,8 @@ Register customized variables</h3>
|
|
|
<h3><a name="register-setting-variable" class="anchor" href="#register-setting-variable" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
|
|
|
Register setting variable</h3>
|
|
|
|
|
|
+<p>This variable will be saved in the database and available as a global variable while editing SEO settings.</p>
|
|
|
+
|
|
|
<div class="highlight highlight-go"><pre>collection.RegisterSEO(&Product{}).RegisterSettingVaribles(struct{ProductTag string}{})
|
|
|
</pre></div>
|
|
|
<h3><a name="render-seo-html-data" class="anchor" href="#render-seo-html-data" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>
|
|
@@ -284,7 +286,7 @@ Customization</h2>
|
|
|
<highlightjs :language='"go"' :code='"var SeoCollection *seo.Collection\n\nfunc ConfigureSeo(b *presets.Builder, db *gorm.DB) {\n\tSeoCollection = seo.NewCollection()\n\tSeoCollection.RegisterSEO(\u0026models.Post{}).RegisterContextVariables(\n\t\t\"Title\",\n\t\tfunc(object interface{}, _ *seo.Setting, _ *http.Request) string {\n\t\t\tif article, ok := object.(models.Post); ok {\n\t\t\t\treturn article.Title\n\t\t\t}\n\t\t\treturn \"\"\n\t\t},\n\t).RegisterSettingVaribles(struct{ Test string }{})\n\tSeoCollection.RegisterSEOByNames(\"Not Found\", \"Internal Server Error\")\n\tSeoCollection.Configure(b, db)\n}\n"'></highlightjs>
|
|
|
<h2><a name="definition" class="anchor" href="#definition" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>Definition</h2>
|
|
|
|
|
|
-<p><code>Collection</code> manages SEO of all the registered models and hold global seo settings.</p>
|
|
|
+<p><code>Collection</code> manages all the registered models and hold global seo settings.</p>
|
|
|
|
|
|
<highlightjs :language='"go"' :code='"type Collection struct {\n\tregisteredSEO []*SEO\n\tglobalName string //default name is GlobalSEO\n\tinherited bool //default is true. the order is model seo setting, system seo setting, global seo setting\n\tdbContextKey interface{} // get db from context\n\tsettingModel interface{} // db model\n}\n"'></highlightjs>
|
|
|
<p><code>SEO</code> provides system-level default page matadata.</p>
|