upcontent 0.1.4 → 0.1.6

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.
@@ -68,7 +68,7 @@ The optional fields below cover navigation, Starlight presentation, and content
68
68
  }
69
69
  },
70
70
  "navigation": {
71
- "roots": ["README.md", "guides"],
71
+ "roots": ["index.md", "guides"],
72
72
  "labelOverrides": { "api": "API reference" },
73
73
  "blocklist": {
74
74
  "exact": ["notes.md"],
@@ -88,7 +88,7 @@ The optional fields below cover navigation, Starlight presentation, and content
88
88
  | Group | Controls |
89
89
  | --- | --- |
90
90
  | `site` | Name, description, URL, social image, locale, logo, and favicon. |
91
- | `seo` | Explicitly enables search-engine discoverability. Defaults to disabled. |
91
+ | `seo` | Explicitly enables search-engine discoverability. Defaults to disabled. See [Search engine visibility](seo/). |
92
92
  | `repo` | Source repository links. |
93
93
  | `theme` | Consumer-owned local CSS. |
94
94
  | `starlight` | Safe layout, social, table of contents, pagination, and code options. |
@@ -7,7 +7,7 @@ sidebar:
7
7
 
8
8
  The sidebar is generated from the consumer file structure. Use configuration when the default filesystem order is not the right experience for readers.
9
9
 
10
- If the repository has a root `index.md`, it becomes the website homepage and a root `README.md` remains available at `/readme/`. Repositories without `index.md` keep the backwards-compatible behavior where `README.md` is the homepage.
10
+ If the repository has a root `index.md`, it becomes the website homepage and the root `README.md` remains GitHub-only. Repositories without `index.md` keep the backwards-compatible behavior where `README.md` is the homepage.
11
11
 
12
12
  ## Select top-level roots
13
13
 
@@ -0,0 +1,106 @@
1
+ ---
2
+ title: Search engine visibility
3
+ description: Configure discoverability, metadata, canonical URLs, robots, and sitemaps for a portal.
4
+ sidebar:
5
+ order: 3
6
+ ---
7
+
8
+ Upcontent treats search-engine discoverability as an explicit site-level policy. SEO is disabled by default so a new portal is not indexed accidentally.
9
+
10
+ ## Enable discoverability
11
+
12
+ Set `seo.enabled` to `true` and provide the canonical site URL:
13
+
14
+ ```json
15
+ {
16
+ "site": {
17
+ "title": "Engineering Docs",
18
+ "description": "Documentation for the engineering team.",
19
+ "url": "https://docs.example.com"
20
+ },
21
+ "seo": {
22
+ "enabled": true
23
+ }
24
+ }
25
+ ```
26
+
27
+ The `site.url` value must be an absolute HTTP(S) URL. `SITE_URL` can provide the URL at build time and takes precedence for the Astro site configuration.
28
+
29
+ When SEO is enabled, Upcontent generates indexable page metadata, canonical URLs, structured data, `robots.txt`, and a sitemap. The sitemap is published at `sitemap-index.xml`.
30
+
31
+ ## Keep a portal unlisted
32
+
33
+ Omit `seo.enabled` or set it to `false` when the portal should be publicly accessible but not discoverable. Upcontent then emits:
34
+
35
+ - `noindex, nofollow` page directives.
36
+ - `Disallow: /` in `robots.txt`.
37
+ - No indexable sitemap URLs.
38
+
39
+ This is an unlisted portal, not a private portal. It does not prevent visitors from accessing pages. Use access-controlled hosting when the content must be private.
40
+
41
+ ## Exclude individual pages
42
+
43
+ An enabled portal can exclude individual pages with page frontmatter:
44
+
45
+ ```yaml
46
+ ---
47
+ title: Internal migration notes
48
+ noindex: true
49
+ ---
50
+ ```
51
+
52
+ The page remains available at its normal route, but it is emitted with `noindex, nofollow` and is omitted from the sitemap.
53
+
54
+ ## Page metadata
55
+
56
+ Use these optional frontmatter fields when a page needs metadata different from the site defaults:
57
+
58
+ ```yaml
59
+ ---
60
+ title: Consumer repository setup
61
+ canonical: https://docs.example.com/getting-started/consumer-repository/
62
+ image: https://docs.example.com/social-cards/consumer-repository.png
63
+ ---
64
+ ```
65
+
66
+ - `title` controls the page title and generated heading metadata.
67
+ - `description` supplies search and social description metadata.
68
+ - `canonical` overrides the generated canonical URL and `og:url`. It must be an absolute HTTP(S) URL.
69
+ - `image` overrides the site-level social image for that page.
70
+ - `noindex` excludes the page from indexing and the sitemap.
71
+
72
+ ## Social previews
73
+
74
+ Set a default social preview image in the site configuration:
75
+
76
+ ```json
77
+ {
78
+ "site": {
79
+ "socialImage": "https://docs.example.com/social-card.png",
80
+ "locale": "en-US"
81
+ }
82
+ }
83
+ ```
84
+
85
+ Page-level `image` takes precedence over `site.socialImage`. Relative image paths resolve from the content repository and are converted to absolute URLs when a canonical site URL is available.
86
+
87
+ ## Deployment paths
88
+
89
+ Set `BASE_PATH` when the portal is served below the domain root:
90
+
91
+ ```sh
92
+ BASE_PATH=/engineering-docs SITE_URL=https://example.com pnpm exec astro build
93
+ ```
94
+
95
+ Generated canonical URLs, sitemap entries, robots output, and internal links include the configured base path. Set `SITE_URL` or `site.url` when the host supports canonical URLs and sitemap generation.
96
+
97
+ ## Validate SEO output
98
+
99
+ Before publishing, verify:
100
+
101
+ ```sh
102
+ pnpm check
103
+ make build CONTENT_PATH=/path/to/your-consumer-repo
104
+ ```
105
+
106
+ Inspect `dist/robots.txt`, `dist/sitemap-index.xml`, and a representative page in `dist/` to confirm that the SEO policy matches the intended portal visibility.
package/index.md CHANGED
@@ -18,6 +18,7 @@ Upcontent turns the documentation repository you already have into a fast, searc
18
18
  - [Run your first build](getting-started/first-build/)
19
19
  - [Configure content](customization/content/)
20
20
  - [Configure navigation](customization/navigation/)
21
+ - [Configure search visibility](customization/seo/)
21
22
  - [Customize the portal](customization/)
22
23
  - [Validate before publishing](guides/validate-your-site/)
23
24
  - [Publish to GitHub Pages](deployment/github-pages/)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "upcontent",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "packageManager": "pnpm@10.20.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -86,6 +86,7 @@ function portalDocsLoader(): Loader {
86
86
  const homepage = hasRootIndex(docsBasePath) ? 'index' : 'readme'
87
87
  const patterns = [
88
88
  '**/[^_]*.{markdown,mdown,mkdn,mkd,mdwn,md,mdx}',
89
+ ...(homepage === 'index' ? ['![rR][eE][aA][dD][mM][eE].{markdown,mdown,mkdn,mkd,mdwn,md,mdx}'] : []),
89
90
  ...getBlocklist().map(blocked => `!${toCaseInsensitiveGlob(blocked)}${blocked.endsWith('/') ? '**' : ''}`),
90
91
  ]
91
92
  const wrappedContext: LoaderContext = {
@@ -98,7 +98,7 @@ describe('buildSidebar', () => {
98
98
  mountFs(ROOT, { 'index.md': null, guides: { 'guide.md': null } })
99
99
 
100
100
  const sidebar = buildSidebar(ROOT)
101
- expect(sidebar[0]).toEqual({ slug: 'index', label: 'Home' })
101
+ expect(sidebar[0]).toEqual({ slug: 'index', label: 'Getting Started' })
102
102
  })
103
103
 
104
104
  it('ignora dotfiles e dot-directories', () => {
@@ -110,13 +110,13 @@ describe('buildSidebar', () => {
110
110
  it('ignora arquivos bloqueados (floor hardcoded)', () => {
111
111
  mountFs(ROOT, { 'CLAUDE.md': null, 'README.md': null })
112
112
  const sidebar = buildSidebar(ROOT)
113
- expect(sidebar).toEqual([{ slug: 'index', label: 'Home' }])
113
+ expect(sidebar).toEqual([{ slug: 'index', label: 'Getting Started' }])
114
114
  })
115
115
 
116
- it('fixa o README em primeiro, relabelado como Home, na frente de tudo', () => {
116
+ it('fixa o README em primeiro, relabelado como Getting Started, na frente de tudo', () => {
117
117
  mountFs(ROOT, { 'README.md': null, domains: { historico: { 'a.md': null } } })
118
118
  const sidebar = buildSidebar(ROOT) as { label: string }[]
119
- expect(sidebar[0]).toEqual({ slug: 'index', label: 'Home' })
119
+ expect(sidebar[0]).toEqual({ slug: 'index', label: 'Getting Started' })
120
120
  expect(sidebar[1].label).toBe('Historico')
121
121
  })
122
122
 
@@ -130,11 +130,11 @@ describe('buildSidebar', () => {
130
130
  expect(sidebar[0]).toEqual({ slug: 'index', label: 'Docs' })
131
131
  })
132
132
 
133
- it('mantém README separado quando index.md é a homepage', () => {
133
+ it('não publica README quando index.md é a homepage', () => {
134
134
  mountFs(ROOT, { 'README.md': null, 'index.markdown': null, domains: { historico: { 'a.md': null } } })
135
135
  const sidebar = buildSidebar(ROOT) as { slug?: string; label?: string }[]
136
- expect(sidebar[0]).toEqual({ slug: 'index', label: 'Home' })
137
- expect(sidebar).toContainEqual({ slug: 'readme', label: 'Readme' })
136
+ expect(sidebar[0]).toEqual({ slug: 'index', label: 'Getting Started' })
137
+ expect(sidebar).not.toContainEqual({ slug: 'readme', label: 'Readme' })
138
138
  })
139
139
 
140
140
  it('aplica labelOverrides do .upcontent/config.json em cima do Title Case', () => {
@@ -98,8 +98,11 @@ export function buildSidebar(docsRoot: string): SidebarEntry[] {
98
98
  const homepage = hasRootIndex(docsRoot) ? 'index' : 'readme'
99
99
  const configuredRoots = getPortalConfig().navigation?.roots
100
100
  const visibleTopLevel = configuredRoots
101
- ? topLevel.filter(({ name, isDir }) => configuredRoots.includes(name) || (!isDir && ['index', 'readme'].includes(toSidebarSlug(name, homepage))))
102
- : topLevel
101
+ ? topLevel.filter(({ name, isDir }) =>
102
+ !(homepage === 'index' && !isDir && toSidebarSlug(name, homepage) === 'readme')
103
+ && (configuredRoots.includes(name) || (!isDir && ['index', 'readme'].includes(toSidebarSlug(name, homepage))))
104
+ )
105
+ : topLevel.filter(({ name, isDir }) => !(homepage === 'index' && !isDir && toSidebarSlug(name, homepage) === 'readme'))
103
106
 
104
107
  const entries: SidebarEntry[] = []
105
108
  for (const { name, isDir } of visibleTopLevel) {
@@ -118,5 +121,5 @@ export function buildSidebar(docsRoot: string): SidebarEntry[] {
118
121
  const homepageIndex = entries.findIndex(e => !isSidebarGroup(e) && e.slug === 'index')
119
122
  const homepageEntry = homepageIndex >= 0 ? entries.splice(homepageIndex, 1)[0] : undefined
120
123
  const sorted = sortEntries(entries)
121
- return homepageEntry ? [{ slug: 'index', label: resolveLabel(homepage, 'Home') }, ...sorted] : sorted
124
+ return homepageEntry ? [{ slug: 'index', label: resolveLabel(homepage, 'Getting Started') }, ...sorted] : sorted
122
125
  }