浏览代码

feat(admin): add sitemap option to general page

Nicolas Giard 3 年之前
父节点
当前提交
1eefdb06e6

+ 2 - 1
.devcontainer/devcontainer.json

@@ -41,7 +41,8 @@
     "mrmlnc.vscode-duplicate",
     "mtxr.sqltools-driver-pg",
     "mutantdino.resourcemonitor",
-    "wayou.vscode-todo-highlight"
+    "wayou.vscode-todo-highlight",
+    "GraphQL.vscode-graphql"
 	],
 
 	// Use 'forwardPorts' to make a list of ports inside the container available locally.

+ 1 - 1
.vscode/settings.json

@@ -13,5 +13,5 @@
   "i18n-ally.localesPaths": [
     "ux/src/i18n/locales"
   ],
-  "i18n-ally.keystyle": "nested"
+  "i18n-ally.keystyle": "flat"
 }

+ 1 - 0
server/db/migrations/3.0.0.js

@@ -465,6 +465,7 @@ exports.up = async knex => {
         search: true
       },
       logoText: true,
+      sitemap: true,
       robots: {
         index: true,
         follow: true

+ 2 - 0
server/graph/schemas/site.graphql

@@ -54,6 +54,7 @@ type Site {
   company: String
   contentLicense: String
   logoText: Boolean
+  sitemap: Boolean
   robots: SiteRobots
   features: SiteFeatures
   defaults: SiteDefaults
@@ -130,6 +131,7 @@ input SiteUpdateInput {
   company: String
   contentLicense: String
   logoText: Boolean
+  sitemap: Boolean
   robots: SiteRobotsInput
   features: SiteFeaturesInput
   defaults: SiteDefaultsInput

+ 1 - 0
server/models/sites.js

@@ -52,6 +52,7 @@ module.exports = class Site extends Model {
         },
         logoUrl: '',
         logoText: true,
+        sitemap: true,
         robots: {
           index: true,
           follow: true

+ 1 - 0
ux/public/_assets/icons/ultraviolet-genealogy.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg"  viewBox="0 0 40 40" width="80px" height="80px"><path fill="#4788c7" d="M7 19H13V20H7z"/><path fill="#4788c7" d="M7 14H18V15H7z" transform="rotate(-90 12.5 14.5)"/><path fill="#4788c7" d="M7 25H18V26H7z" transform="rotate(-90 12.5 25.5)"/><path fill="#4788c7" d="M24 9H33V10H24z" transform="rotate(-90 28.5 9.5)"/><path fill="#4788c7" d="M12 9H28V10H12zM28 5H38V6H28zM28 13H38V14H28z"/><path fill="#4788c7" d="M24 30H33V31H24z" transform="rotate(-90 28.5 30.5)"/><path fill="#4788c7" d="M13 30H28V31H13zM28 26H38V27H28zM28 34H38V35H28z"/><path fill="#98ccfd" d="M16.5 5.5H24.5V13.5H16.5z"/><path fill="#4788c7" d="M24,6v7h-7V6H24 M25,5h-9v9h9V5L25,5z"/><path fill="#98ccfd" d="M32.5 2.5H38.5V8.5H32.5z"/><path fill="#4788c7" d="M38,3v5h-5V3H38 M39,2h-7v7h7V2L39,2z"/><path fill="#98ccfd" d="M32.5 10.5H38.5V16.5H32.5z"/><path fill="#4788c7" d="M38,11v5h-5v-5H38 M39,10h-7v7h7V10L39,10z"/><path fill="#98ccfd" d="M16.5 26.5H24.5V34.5H16.5z"/><path fill="#4788c7" d="M24,27v7h-7v-7H24 M25,26h-9v9h9V26L25,26z"/><g><path fill="#98ccfd" d="M32.5 23.5H38.5V29.5H32.5z"/><path fill="#4788c7" d="M38,24v5h-5v-5H38 M39,23h-7v7h7V23L39,23z"/></g><g><path fill="#98ccfd" d="M32.5 31.5H38.5V37.5H32.5z"/><path fill="#4788c7" d="M38,32v5h-5v-5H38 M39,31h-7v7h7V31L39,31z"/></g><g><path fill="#dff0fe" d="M1.5 15.5H9.5V23.5H1.5z"/><path fill="#4788c7" d="M9,16v7H2v-7H9 M10,15H1v9h9V15L10,15z"/></g></svg>

+ 3 - 1
ux/src/i18n/locales/en.json

@@ -199,6 +199,7 @@
   "admin.general.siteHostnameHint": "Hostname this site should respond to. Set * for catch-all / fallback domain.",
   "admin.general.siteHostnameInvalid": "Invalid Hostname",
   "admin.general.siteInfo": "Site Info",
+  "admin.general.sitemap": "Allow Sitemap",
   "admin.general.siteTitle": "Site Title",
   "admin.general.siteTitleHint": "Displayed in the top bar and appended to all pages meta title.",
   "admin.general.siteTitleInvalidChars": "Site Title contains invalid characters.",
@@ -1419,5 +1420,6 @@
   "tags.retrievingResultsLoading": "Retrieving page results...",
   "tags.searchWithinResultsPlaceholder": "Search within results...",
   "tags.selectOneMoreTags": "Select one or more tags",
-  "tags.selectOneMoreTagsHint": "Select one or more tags on the left."
+  "tags.selectOneMoreTagsHint": "Select one or more tags on the left.",
+  "admin.general.sitemapHint": "Make a sitemap.xml available to search engines with all pages accessible to guests."
 }

+ 22 - 1
ux/src/pages/AdminGeneral.vue

@@ -372,6 +372,20 @@ q-page.admin-general
               unchecked-icon='las la-times'
               :aria-label='t(`admin.general.searchAllowFollow`)'
               )
+        q-separator.q-my-sm(inset)
+        q-item(tag='label')
+          blueprint-icon(icon='genealogy')
+          q-item-section
+            q-item-label {{t(`admin.general.sitemap`)}}
+            q-item-label(caption) {{t(`admin.general.sitemapHint`)}}
+          q-item-section(avatar)
+            q-toggle(
+              v-model='state.config.sitemap'
+              color='primary'
+              checked-icon='las la-check'
+              unchecked-icon='las la-times'
+              :aria-label='t(`admin.general.sitemap`)'
+              )
 
 </template>
 
@@ -432,7 +446,12 @@ const state = reactive({
       timezone: '',
       dateFormat: '',
       timeFormat: ''
-    }
+    },
+    robots: {
+      index: false,
+      follow: false
+    },
+    sitemap: false
   }
 })
 
@@ -499,6 +518,7 @@ async function load () {
           company
           contentLicense
           logoText
+          sitemap
           robots {
             index
             follow
@@ -559,6 +579,7 @@ async function save () {
           company: state.config.company ?? '',
           contentLicense: state.config.contentLicense ?? '',
           logoText: state.config.logoText ?? false,
+          sitemap: state.config.sitemap ?? false,
           robots: {
             index: state.config.robots?.index ?? false,
             follow: state.config.robots?.follow ?? false