Skip to content

Commit

Permalink
update ChangeFreq to support typescript configurations with string …
Browse files Browse the repository at this point in the history
…literal (withastro#6262)

* update `ChangeFreq`

* `pnpm exec changeset`

* use @Princesseuh suggested change

* Revert "use @Princesseuh suggested change"

This reverts commit a1e5660.

* use @Princesseuh suggested change and an `as`
  • Loading branch information
vic1707 authored and liruifengv committed Feb 18, 2023
1 parent 48e5964 commit ec9603e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-years-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/sitemap': minor
---

update `ChangeFreq` to support typescript configurations with string literal or predefined value.
3 changes: 2 additions & 1 deletion packages/integrations/sitemap/src/generate-sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { EnumChangefreq } from 'sitemap';
import type { SitemapItem, SitemapOptions } from './index.js';
import { parseUrl } from './utils/parse-url.js';

Expand Down Expand Up @@ -44,7 +45,7 @@ export function generateSitemap(pages: string[], finalSiteUrl: string, opts: Sit
links,
lastmod,
priority,
changefreq,
changefreq: changefreq as EnumChangefreq,
};
});

Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/sitemap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { generateSitemap } from './generate-sitemap.js';
import { Logger } from './utils/logger.js';
import { validateOptions } from './validate-options.js';

export type ChangeFreq = EnumChangefreq;
export type ChangeFreq = `${EnumChangefreq}`;
export type SitemapItem = Pick<
SitemapItemLoose,
'url' | 'lastmod' | 'changefreq' | 'priority' | 'links'
Expand Down

0 comments on commit ec9603e

Please sign in to comment.