or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

content-integration.mddata-types-configuration.mdindex.mdmodule-configuration.mdserver-composables.mdxml-html-utilities.md

module-configuration.mddocs/

0

# Module Configuration

1

2

Core Nuxt module setup and comprehensive configuration options for sitemap generation, including single/multiple sitemap support, caching, filtering, and i18n integration.

3

4

## Capabilities

5

6

### Default Module Export

7

8

The main Nuxt module definition that provides all sitemap functionality.

9

10

```typescript { .api }

11

/**

12

* @nuxtjs/sitemap Nuxt module

13

* Main module function that integrates sitemap generation into Nuxt applications

14

*/

15

declare const _default: NuxtModule<ModuleOptions>;

16

export default _default;

17

18

export interface ModuleOptions extends SitemapDefinition {

19

enabled: boolean;

20

debug: boolean;

21

minify: boolean;

22

credits: boolean;

23

cacheMaxAgeSeconds: number | false;

24

autoLastmod: boolean;

25

discoverImages: boolean;

26

discoverVideos: boolean;

27

sortEntries: boolean;

28

excludeAppSources: true | AppSourceContext[];

29

sitemaps?: boolean | MultiSitemapsInput;

30

sitemapsPathPrefix: string | false;

31

appendSitemaps?: (string | SitemapIndexEntry)[];

32

xsl: string | false;

33

xslTips: boolean;

34

xslColumns?: XslColumn[];

35

defaultSitemapsChunkSize: number | false;

36

runtimeCacheStorage: boolean | (Record<string, any> & { driver: string });

37

autoI18n?: boolean | AutoI18nConfig;

38

strictNuxtContentPaths: boolean;

39

experimentalWarmUp?: boolean;

40

experimentalCompression?: boolean;

41

}

42

```

43

44

### Core Configuration Options

45

46

**Basic Setup Options**

47

48

```typescript { .api }

49

interface CoreOptions {

50

/** Whether the sitemap.xml should be generated (default: true) */

51

enabled: boolean;

52

/** Enables debug logs and a debug endpoint (default: false) */

53

debug: boolean;

54

/** Minify the sitemap XML (default: false) */

55

minify: boolean;

56

/** Should lastmod be automatically added to the sitemap (default: false) */

57

autoLastmod: boolean;

58

/** Should the sitemap.xml display credits for the module (default: true) */

59

credits: boolean;

60

/** How long, in seconds, should the sitemap be cached for (default: 600) */

61

cacheMaxAgeSeconds: number | false;

62

}

63

```

64

65

### Discovery and Media Options

66

67

Configuration for automatic content discovery during prerendering.

68

69

```typescript { .api }

70

interface DiscoveryOptions {

71

/** When prerendering, should images be automatically discovered and added to the sitemap (default: true) */

72

discoverImages: boolean;

73

/** When prerendering, should videos be automatically discovered and added to the sitemap (default: true) */

74

discoverVideos: boolean;

75

/** Should the entries be sorted by loc (default: true) */

76

sortEntries: boolean;

77

/** Sources to exclude from the sitemap */

78

excludeAppSources: true | AppSourceContext[];

79

}

80

81

type AppSourceContext =

82

| 'nuxt:pages'

83

| 'nuxt:prerender'

84

| 'nuxt:route-rules'

85

| '@nuxtjs/i18n:pages'

86

| '@nuxt/content:document-driven';

87

```

88

89

### Multiple Sitemaps Configuration

90

91

Support for generating multiple categorized sitemaps with sitemap index files.

92

93

```typescript { .api }

94

interface MultiSitemapOptions {

95

/** Multiple sitemap support for large sites (default: false) */

96

sitemaps?: boolean | MultiSitemapsInput;

97

/** The path prefix for the sitemaps (default: '/__sitemap__/') */

98

sitemapsPathPrefix: string | false;

99

/** Sitemaps to append to the sitemap index (only works with multiple sitemaps) */

100

appendSitemaps?: (string | SitemapIndexEntry)[];

101

/** When chunking sitemaps into multiple files, how many entries per file (default: 1000) */

102

defaultSitemapsChunkSize: number | false;

103

}

104

105

type MultiSitemapsInput = Partial<MultiSitemapEntry> & Partial<IndexSitemapRemotes>;

106

107

interface MultiSitemapEntry {

108

[key: string]: Partial<SitemapDefinition>;

109

}

110

111

interface SitemapIndexEntry {

112

sitemap: string;

113

lastmod?: string;

114

_sitemapName?: string;

115

}

116

```

117

118

### Styling and Presentation Options

119

120

Configuration for XML stylesheet and visual presentation of sitemaps.

121

122

```typescript { .api }

123

interface StylingOptions {

124

/** Path to the XSL that styles sitemap.xml. Set to false to disable styling (default: '/__sitemap__/style.xsl') */

125

xsl: string | false;

126

/** Toggle the tips displayed in the XSL (default: true) */

127

xslTips: boolean;

128

/** Customize the columns displayed in the XSL */

129

xslColumns?: XslColumn[];

130

}

131

132

interface XslColumn {

133

label: string;

134

width: `${string}%`;

135

select?: string;

136

}

137

```

138

139

### Caching and Storage Configuration

140

141

Runtime cache configuration for performance optimization.

142

143

```typescript { .api }

144

interface CacheOptions {

145

/**

146

* Modify the cache behavior.

147

* Boolean enables/disables runtime cache with default options.

148

* Record allows full configuration of runtime cache.

149

* (default: true)

150

*/

151

runtimeCacheStorage: boolean | (Record<string, any> & {

152

driver: string;

153

});

154

}

155

```

156

157

### Internationalization Support

158

159

Configuration for i18n integration and multi-language sitemap generation.

160

161

```typescript { .api }

162

interface I18nOptions {

163

/** Automatically add alternative links to the sitemap based on a prefix list */

164

autoI18n?: boolean | AutoI18nConfig;

165

/** Enable when your nuxt/content files match your pages (default: false) */

166

strictNuxtContentPaths: boolean;

167

}

168

169

interface AutoI18nConfig {

170

differentDomains?: boolean;

171

locales: (LocaleObject & { _sitemap: string, _hreflang: string })[];

172

defaultLocale: string;

173

strategy: 'prefix' | 'prefix_except_default' | 'prefix_and_default' | 'no_prefix';

174

pages?: Record<string, Record<string, string | false>>;

175

}

176

177

interface LocaleObject extends Record<string, any> {

178

code: string;

179

name?: string;

180

dir?: 'ltr' | 'rtl' | 'auto';

181

domain?: string;

182

language?: string;

183

}

184

```

185

186

### Experimental Features

187

188

Experimental features that may be enabled by default in future versions.

189

190

```typescript { .api }

191

interface ExperimentalOptions {

192

/** Warm up the sitemap route(s) cache when Nitro starts */

193

experimentalWarmUp?: boolean;

194

/** Send the Sitemap as a compressed stream supporting gzip, brotli, etc. */

195

experimentalCompression?: boolean;

196

}

197

```

198

199

**Usage Examples:**

200

201

```typescript

202

// nuxt.config.ts - Basic configuration

203

export default defineNuxtConfig({

204

modules: ['@nuxtjs/sitemap'],

205

sitemap: {

206

hostname: 'https://example.com',

207

enabled: true,

208

debug: false,

209

minify: true,

210

cacheMaxAgeSeconds: 3600,

211

autoLastmod: true,

212

discoverImages: true,

213

urls: ['/custom-page']

214

}

215

})

216

217

// Multiple sitemaps configuration

218

export default defineNuxtConfig({

219

modules: ['@nuxtjs/sitemap'],

220

sitemap: {

221

hostname: 'https://example.com',

222

sitemaps: {

223

posts: {

224

includeAppSources: true,

225

include: ['/blog/**'],

226

defaults: { changefreq: 'weekly', priority: 0.7 }

227

},

228

pages: {

229

includeAppSources: true,

230

exclude: ['/blog/**'],

231

defaults: { changefreq: 'monthly', priority: 0.5 }

232

}

233

}

234

}

235

})

236

237

// i18n integration

238

export default defineNuxtConfig({

239

modules: ['@nuxtjs/sitemap', '@nuxtjs/i18n'],

240

sitemap: {

241

hostname: 'https://example.com',

242

autoI18n: true

243

}

244

})

245

```