Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minify xml #64

Open
juchom opened this issue Oct 25, 2024 · 2 comments
Open

Minify xml #64

juchom opened this issue Oct 25, 2024 · 2 comments

Comments

@juchom
Copy link

juchom commented Oct 25, 2024

Hello again,

Continuing my journey with 11ty, I saw that my sitemap.xml had some big holes in it.

Do you think this would be interesting to change the html-config.js like this

const isProduction = process.env.ELEVENTY_ENV === 'production';
export const htmlConfig = eleventyConfig => {
eleventyConfig.addTransform('html-minify', (content, path) => {
if (path && path.endsWith('.html') && isProduction) {

To something like this :

const isProduction = process.env.ELEVENTY_ENV === 'production';

const extensions = ['.html', '.xml']

export const htmlConfig = eleventyConfig => {
  eleventyConfig.addTransform('html-minify', (content, path) => {
    if (path && extensions.some(ext => path.endsWith(ext)) && isProduction) {
@madrilene
Copy link
Owner

I'll look into that, though I believe doing it like that does also make the .xml feeds invalid

@juchom
Copy link
Author

juchom commented Oct 25, 2024

I have just checked with 2 xml validators and it seems to be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants