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

Prevent search engines from showing outdated docs #33

Open
hamogu opened this issue Jun 28, 2017 · 3 comments
Open

Prevent search engines from showing outdated docs #33

hamogu opened this issue Jun 28, 2017 · 3 comments

Comments

@hamogu
Copy link
Member

hamogu commented Jun 28, 2017

Current marx documentation is a the canonical address space.mit.edu/cxc/marx but all the old version are still available at marx-5.0, marx-5.1 etc.
I want users who come by google to automatically find the new version. Two options would be:

  • add the old path to http://space.mit.edu/robots.txt and update after every release.
  • modify the old webpages to include a box saying "This is an old version. Please see..."
    In principle, I prefer this method, but it requires me to update the old docs again after uploading the new ones. It would be kind of annoying to rebuild the old docs with added content, so I'd better add a switch when building them in the first place (like "include this file", where "file" is originally empty and added by me later. Second, it would be useful to point to the new canonical version of the same page, not just the top level marx. However that requires individual updates on every page and what to do if the new pages does not exist? Maybe I find some javascript code somewhere that activates a box only if a newer file is present and constructs the link if possible. In any case, I would still have to go back to change the old docs that are already on the server (or go back to the robots.txt method for those).
@hamogu hamogu changed the title Prevent search engines fomr showing outdated docs Prevent search engines from showing outdated docs Jun 28, 2017
@hamogu
Copy link
Member Author

hamogu commented Jun 28, 2017

A tried a few searches. The very old pdfs for marxs 3.0 and 4.0 come up, but all the links I've seen to web pages point to /marx/ with no version number attached to this is not a problem right now. I should just think about steps to prevent this from becoming a problem in the future (CIAO needs to address that now).

@hamogu
Copy link
Member Author

hamogu commented Jun 28, 2017

https://support.google.com/webmasters/answer/139066?hl=en#2 could be used to make sure the canonical page in indexed not the specific page.

@hamogu
Copy link
Member Author

hamogu commented Jul 5, 2017

Here are some notes from a search to find the appropriate Javascript commands to insert something if present:
Insert something:

var text = document.createTextNode('the text');
var child = document.getElementById('childDiv');
child.parentNode.insertBefore(text, child);

check if present:

$.ajax({
    url:'http://www.example.com/somefile.ext',
    type:'HEAD',
    error: function()
    {
        //file not exists
    },
    success: function()
    {
        //file exists
    }
});

This is even easier:
Client Side Includes from http://ask-leo.com/how_do_i_include_one_html_file_inside_another.html

As I mentioned above, there is no actual syntax for a client-side include but we can mimic one using Javascript. For example:

<script src="b.js" type="text/javascript"> </script> 

When encountered, the browser downloads the script "b.js", executes it, and prints any output that the script might generate as if it were inline HTML. Technically that's not an include but the script "b.js" could be nothing more than a series of javascript "print" statements such as these:

document.write("<table>")
document.write("<tr>")
... and so on 

"Welcome to 'include' files - an incredibly powerful facility that can do this, and so much more, on your web site."

You can see it's "printing" the HTML you want included. In other words, if you can format your include file as a series of javascript prints, you can use client-side include to insert it.

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

1 participant