@sewadah/selaras-docs 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.4.1
4
+
5
+ [compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.4.0...selaras-docs-v1.4.1)
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - **fix(docs):** respect consumer site URLs ([27b5e15](https://github.com/sewadahapp/selaras/commit/27b5e15da601c2b3904c7f4b87466fe93e6d9679))
10
+ - **fix(docs):** restore localized sidebar navigation ([541d7a4](https://github.com/sewadahapp/selaras/commit/541d7a4627c66a2e0079d03aa0b7d0b08872084f))
11
+
12
+ ### 🤖 Other changes
13
+
14
+ - Merge pull request #34 from sewadahapp/fix/docs-indonesian-sidebar ([b9fe143](https://github.com/sewadahapp/selaras/commit/b9fe143253de9ee89f2e0631f89df9606911eb56))
15
+
16
+ Published against `@sewadah/selaras` ^1.2.0.
17
+
3
18
  ## v1.4.0
4
19
 
5
20
  [compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.3.3...selaras-docs-v1.4.0)
package/README.md CHANGED
@@ -111,6 +111,9 @@ export default defineAppConfig({
111
111
  })
112
112
  ```
113
113
 
114
+ Set `selarasDocs.site.url` to your public site origin to generate canonical and
115
+ Open Graph URLs. When omitted, the layer leaves these URLs to your app.
116
+
114
117
  Folder navigation can be configured with a `.navigation.yml` file alongside
115
118
  the Markdown pages in that folder:
116
119
 
@@ -10,7 +10,10 @@ export function useDocsNavigation() {
10
10
  .map(option => option.code)
11
11
  .filter(code => code !== defaultLocale.value))
12
12
 
13
- return useAsyncData('selaras-docs-navigation', async () => {
13
+ // Prerendering shares results by key, so each locale needs its own tree.
14
+ return useAsyncData(() => `selaras-docs-navigation:${defaultLocale.value}:${locale.value}`, async () => {
15
+ const activeLocale = locale.value
16
+ const activeDefaultLocale = defaultLocale.value
14
17
  const tree = await queryCollectionNavigation('docs', ['order', 'icon', 'collapse', 'navBadges'])
15
18
  .order('order', 'ASC')
16
19
 
@@ -19,7 +22,7 @@ export function useDocsNavigation() {
19
22
  // contribute their own titles; untranslated pages keep the source title.
20
23
  let defaultTree = withoutDocsLocaleFolders(tree as DocsNavigationNode[], localeFolders.value)
21
24
 
22
- if (locale.value !== defaultLocale.value && translatedFolder.value) {
25
+ if (activeLocale !== activeDefaultLocale && translatedFolder.value) {
23
26
  const translated = await queryCollection('docs')
24
27
  .where('path', 'LIKE', `/${translatedFolder.value}/%`)
25
28
  .select('path', 'title')
@@ -57,10 +60,10 @@ export function useDocsNavigation() {
57
60
 
58
61
  const localize = (items: DocsNavigationNode[]): DocsNavigationNode[] => items.map(item => ({
59
62
  ...item,
60
- path: docsLocalizedRoutePath(item.path, locale.value, defaultLocale.value),
63
+ path: docsLocalizedRoutePath(item.path, activeLocale, activeDefaultLocale),
61
64
  ...(item.children ? { children: localize(item.children) } : {}),
62
65
  }))
63
66
 
64
67
  return localize(visit(defaultTree, excluded.size > 0))
65
- }, { watch: [locale, defaultLocale] })
68
+ })
66
69
  }
@@ -8,7 +8,7 @@ import ProseH5 from '@sewadah/selaras/components/ProseH5.vue'
8
8
  import ProseH6 from '@sewadah/selaras/components/ProseH6.vue'
9
9
  import ProsePre from '@sewadah/selaras/components/ProsePre.vue'
10
10
  import { docsDefaultContentPath, docsLocalizedRoutePath } from '../utils/content-path'
11
- import { docsCanonicalUrl, docsSite } from '../utils/seo'
11
+ import { docsCanonicalUrl } from '../utils/seo'
12
12
 
13
13
  const route = useRoute()
14
14
  const appConfig = useAppConfig()
@@ -36,7 +36,7 @@ async function retryPage() {
36
36
 
37
37
  definePageMeta({ layout: 'selaras-docs' })
38
38
  const { locale, defaultLocale, locales, localeOption } = useDocsLocale()
39
- const siteUrl = appConfig.selarasDocs?.site?.url || docsSite.url
39
+ const siteUrl = appConfig.selarasDocs?.site?.url
40
40
  const config = useRuntimeConfig()
41
41
  const defaultRoutePath = computed(() => docsDefaultContentPath(contentPath.value, locale.value, defaultLocale.value))
42
42
  const translatedPage = computed(() => locale.value !== defaultLocale.value && contentPath.value.startsWith(`/${locale.value}/`))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sewadah/selaras-docs",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "description": "Nuxt Content documentation layer for Selaras",
6
6
  "repository": {
7
7
  "type": "git",
package/types.d.ts CHANGED
@@ -126,6 +126,7 @@ export interface SelarasDocsAppConfig {
126
126
  description?: string
127
127
  /** Applied to browser titles; `%s` is replaced with the current page title. */
128
128
  titleTemplate?: string
129
+ /** Public site origin for canonical and Open Graph URLs. These URL tags are omitted when unset. */
129
130
  url?: string
130
131
  /** Shown in the header and footer. A `/`-rooted path is served from `public/` under the app's base URL. */
131
132
  logo?: string | SelarasDocsLogo