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

[helix5] add newline at end of default robots.txt and sitemap.xml #600

Open
royfielding opened this issue May 10, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@royfielding
Copy link

Description
The generated default robots.txt and generated sitemap.xml files do not have a newline at the EOF, which can cause problems with poorly written text-based parsers.

To Reproduce

curl https://www.gjfielding.com/robots.txt
curl https://www.gjfielding.com/sitemap.xml

Expected behavior
Generate a \n at end of last line.

Additional context
The code in src/robots-pipe.js:

  const txt = [
    'User-Agent: *',
    'Allow: /',
    '',
    `Sitemap: https://${prodHost}/sitemap.xml`,
  ].join('\n');

should either have '' at end of list or be a literal like

  const txt = `User-Agent: *
Allow: /

Sitemap: https://${prodHost}/sitemap.xml
`;
 

maybe (I don't have much javascript language experience).

The same join technique is used in sitemap-pipe.js and can be fixed in same way.

@royfielding royfielding added the bug Something isn't working label May 10, 2024
@tripodsan
Copy link
Contributor

thanks @royfielding .
I think adding the '' empty line at the end of the array is the easiest to adjust.
pull request welcome :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants