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

Overwriting existing robots.txt #189

Closed
justinperkins opened this issue Sep 13, 2017 · 14 comments
Closed

Overwriting existing robots.txt #189

justinperkins opened this issue Sep 13, 2017 · 14 comments

Comments

@justinperkins
Copy link

It appears that this gem assumes that a robots.txt file doesn't already exist? Or maybe it does but it's being overwritten? Or perhaps I'm including the gem/plugin in the wrong order?

I have a robots.txt file defined in my _pages directory, so that I can have a bit of control over what type of robots are allowed into my various environments, but all of that is being blown away once that I've added this gem.

@pathawks
Copy link
Member

Yup, you've found a bug.

@site.pages << robots unless file_exists?("robots.txt")

def file_exists?(file_path)
if @site.respond_to?(:in_source_dir)
File.exist? @site.in_source_dir(file_path)
else
File.exist? Jekyll.sanitized_path(@site.source, file_path)
end
end

We are only checking if robots.txt exists in the source. If a user creates that file some other way, we will overwrite it.

@benbalter
Copy link
Contributor

I think this should be something like (site.pages + site.static_files).any? { |p| p.url = "robots.txt" }

@jekyllbot

This comment has been minimized.

@jekyllbot

This comment has been minimized.

@benbalter
Copy link
Contributor

Still would like help with this issue if anyone is interested.

@jekyllbot jekyllbot removed the stale label Jan 22, 2018
@jekyllbot

This comment has been minimized.

@gsantner
Copy link

This is still happening.

@jekyllbot jekyllbot removed the stale label Apr 20, 2018
kmotrebski added a commit to kmotrebski/kmotrebski.github.io that referenced this issue May 28, 2018
m3adow added a commit to m3adow/m3adow.github.io that referenced this issue Nov 23, 2018
@rahulkumarsingh73690

This comment has been minimized.

@justinperkins

This comment has been minimized.

@jveillet
Copy link
Contributor

jveillet commented Apr 9, 2019

Hello, I've made a PR, I am not sure it covers the original author problems, but if someone would care to have a look and test it, it would be much appreciated! feedback welcomed 😊

@brandonb927
Copy link

Hi folks! I love the plugin, great work! Any plan to publish a new release with the merged PR to fix the original issue?

@coliff
Copy link
Member

coliff commented Nov 29, 2019

v1.4.0 is available now so I think this issue can be closed.
https://github.com/jekyll/jekyll-sitemap/releases

Do you know when this will be available on GitHub pages though? The version there is still on v1.2.0.
https://pages.github.com/versions/

@DirtyF DirtyF removed the pinned label Nov 29, 2019
@DirtyF DirtyF closed this as completed Nov 29, 2019
@DirtyF
Copy link
Member

DirtyF commented Nov 29, 2019

@coliff Can't say, apparently dependabot is not active on https://github.com/github/pages-gem but feel free to open an issue there.

@coliff
Copy link
Member

coliff commented Nov 29, 2019

Ah, found that there is currently an open PR to update a bunch of Jekyll plugins for GitHub Pages - including this one. :-)
github/pages-gem#664

@DirtyF DirtyF unpinned this issue Aug 15, 2020
@jekyll jekyll locked and limited conversation to collaborators Nov 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests