From 1eefdb06e60abfd41aea11724582bd866c86db81 Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Tue, 24 May 2022 02:42:17 +0000 Subject: [PATCH] feat(admin): add sitemap option to general page --- .devcontainer/devcontainer.json | 3 ++- .vscode/settings.json | 2 +- server/db/migrations/3.0.0.js | 1 + server/graph/schemas/site.graphql | 2 ++ server/models/sites.js | 1 + .../_assets/icons/ultraviolet-genealogy.svg | 1 + ux/src/i18n/locales/en.json | 4 +++- ux/src/pages/AdminGeneral.vue | 23 ++++++++++++++++++- 8 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 ux/public/_assets/icons/ultraviolet-genealogy.svg diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b5428642..5099b8b0 100644 --- a/.devcontainer/devcontainer.json +++ b/.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. diff --git a/.vscode/settings.json b/.vscode/settings.json index 6176f85a..bf9d4f27 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,5 +13,5 @@ "i18n-ally.localesPaths": [ "ux/src/i18n/locales" ], - "i18n-ally.keystyle": "nested" + "i18n-ally.keystyle": "flat" } diff --git a/server/db/migrations/3.0.0.js b/server/db/migrations/3.0.0.js index bd2e3411..4b842b74 100644 --- a/server/db/migrations/3.0.0.js +++ b/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 diff --git a/server/graph/schemas/site.graphql b/server/graph/schemas/site.graphql index f6778180..efd9cced 100644 --- a/server/graph/schemas/site.graphql +++ b/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 diff --git a/server/models/sites.js b/server/models/sites.js index f53a72f5..8ff1da29 100644 --- a/server/models/sites.js +++ b/server/models/sites.js @@ -52,6 +52,7 @@ module.exports = class Site extends Model { }, logoUrl: '', logoText: true, + sitemap: true, robots: { index: true, follow: true diff --git a/ux/public/_assets/icons/ultraviolet-genealogy.svg b/ux/public/_assets/icons/ultraviolet-genealogy.svg new file mode 100644 index 00000000..ca54032e --- /dev/null +++ b/ux/public/_assets/icons/ultraviolet-genealogy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ux/src/i18n/locales/en.json b/ux/src/i18n/locales/en.json index 8d6c5099..405204c2 100644 --- a/ux/src/i18n/locales/en.json +++ b/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." } diff --git a/ux/src/pages/AdminGeneral.vue b/ux/src/pages/AdminGeneral.vue index 200976c1..7d7c2326 100644 --- a/ux/src/pages/AdminGeneral.vue +++ b/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`)' + ) @@ -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