1

I have a small static website which allows customers to purchase a PDF containing some data based from an input from them. The PDF's are a page or two and follow a standard template, and various values change based upon the what the customers are searching for, and I expect them to be unique per customer (i.e 99% chance of having a unique PDF, although majority of the content within the PDF may be similar).

Previously I haven't made the PDF's searchable, however I've wanted to start including them and have written some code that dynamically gets all the available PDF's and generates a page where they are listed with a hyperlink to open them using this PHP code embedded in a HTML page :-

$directory = "../logs/reports/";

$files = glob($directory . "*.pdf");

foreach($files as $phpfile)
{
    $filename = basename($file);
    echo '<a href="/includes/getreport.php?file='.urlencode($filename).'">'.basename($file).'</a><br>';
}

My sitemap is reflecting the new page with weekly change frequency

<url>
  <loc>https://www.myurl.com/reportlist.html</loc>
  <changefreq>Weekly</changefreq>
</url>  

I forgot to update my robots.txt initially for an allow rule as I had a disallow on /includes/ where the PHP file that retrieves the report is located, so I updated it and it now looks like the below

User-agent: *
Disallow: /font/
Disallow: /includes/
Disallow: /js/
Disallow: /wdsl/
Allow: /includes/getreport.php

My Search Console is now showing the following under Index Status

Search Console so the links to the PDF's are being crawled, but apparently links are blocked by robots.txt from being crawled. If I check the robots.txt Tester of a URL I get the following

robots.txt tester

I've tried putting the allow statement in the robots.txt at the top originally, and then at the below as per the current setup, and it appears to have been seen by Google after the changes.

If run Fetch as Bingbot I get the following

enter image description here

which suggest that robots.txt can access the page and retrieve the PDF, and although it looks like there is no visible text, I'm not overally worried as according to https://webmasters.googleblog.com/2011/09/pdfs-in-google-search-results.html these PDF's may be searchable by OCR, and I can cut and paste text from them via a PDF reader.

Lastly if I check my search results via site:mysite.com I see a number of links with "A description for this result is not available because of this site's robots.txt" so it seems to think they aren't searchable.

So my question is two-fold, firstly why are these appearing as blocked in Search Console, not sure if waiting longer is the answer as the Index Status seems to be changing and the number of indexed pages is dropping, but the blocked by robots seems to remain the same. Secondly will indexing this sort of content be problematic?

1 Answer 1

1

It appears you're using query strings on a PHP page to generate the file links. Try adding a wildcard to the end of your ALLOW, as this will form part of the URI.

Also, have you checked the URL parameters section to see how Google is treating these variables? You can also explicitly set behaviour, make sure Google understands how to use the query strings when it's indexing.

3
  • Thanks, the URL parameters was the issue, I had 1,216 URL's sitting under the file parameter (from getreport.php?file=), so I've specified that Googlebot should crawl 'Every URL' as the page content changes for each value.
    – LJT
    Jun 17, 2016 at 22:36
  • @LJT: What do you mean with 'Every URL'? Is this a setting in Google’s Search Console? -- The line Allow: /includes/getreport.php should also allow URLs like /includes/getreport.php?foo=bar, because in robots.txt you specify the beginning of the URL path.
    – unor
    Jun 18, 2016 at 14:36
  • Yes it's a setting within URL parameters, see here. I agree I don't need to actually add a wildcard to the robots.txt as per this
    – LJT
    Jun 18, 2016 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.