Hi,
CPAN mirror sites sometimes want to add some sponsor info
to the mirrored CPAN home page. This is allowed, but the
documented[1] method is vague and not elegant.
I propose we fix this ; see (the source of) :
http://cpan.cs.uu.nl/ondex.html
Changes :
-- add "<script src="/local/site.js" charset="utf-8"></script>"
-- add a javascript function "hostedby()"
-- add an empty <span id="hostedby"> in the "footer_mirror" section
A mirror site can set a sponsor logo without changing /index.html ;
simply by adding "/local/site.js", containing something like :
var site_url = 'http://www.cs.uu.nl/' ;
var site_img = 'http://www.cs.uu.nl/icons/li-dsol.png' ;
[1] see the source of https://www.cpan.org/
A "diff -u" is included below.
Regards,
Henk Penning
------------------------------------------------------------ _
Henk P. Penning, ICT-beta R Uithof MG-403 _/ \_
Faculty of Science, Utrecht University T +31 30 253 4106 / \_/ \
Leuvenlaan 4, 3584CE Utrecht, NL F +31 30 253 4553 \_/ \_/
http://www.staff.science.uu.nl/~penni101/ M penn...@uu.nl \_/
--- index.html 2017-12-30 12:24:02.000000000 +0100
+++ ondex.html 2017-12-30 12:31:02.312188519 +0100
@@ -27,22 +27,18 @@
the SITES.html and SITES files at the top level of CPAN
and also listed at the site http://mirrors.cpan.org/.
- You are not allowed to alter any file
- in you public mirror of CPAN
- EXCEPT
- that you can add a short acknowledgement for example
- for your hosting company, company, university, or sponsor,
- into this CPAN top-level index.html by adding a small
- non-animated image and a hyperlink pointing to your organization
- with text like "hosted by", "powered by", or "sponsored by",
- by placing it visually next to the "CPAN master site hosted by YellowBot"
- acknowledgement at the bottom of the page.
- The image used may not be larger than the one used for the YellowBot logo.
- (Technical sidenote: if you do add an acknowledgement link,
- please do think of the consequences to your possible downstream
- CPAN mirrors.)
- Altering this index.html in any other way is not allowed.
- Altering any other files is not allowed.
+ You are not allowed to alter any file in you public mirror of CPAN.
+
+ To add a sponsor link/logo :
+ -- cd /your/path/to/CPAN
+ -- mkdir local
+ -- create local/site.js containing
+ var site_url = 'http://www.your.org/' ;
+ var site_img = 'http://www.your.org/icons/logo.png' ;
+ -- in your cronjob, add rsync option "--exclude /local/"
+ -- if you export CPAN via rsync, exclude CPAN/local/
+ in your rsyncd.conf with "exclude = /local/".
+ The image used may not be larger than the other sponsor logo's.
Adding any advertisements or any revenue-generating material
is strictly forbidden.
@@ -51,6 +47,8 @@
the CPAN web pages into other sites by using e.g. HTML tables
or frames is not allowed.
+ Directory listings must be plain ; like http://www.cpan.org/indices/.
+
You are allowed to use the files of CPAN to create your own
web sites and services since we are just a distributor of the files,
we do not own most of them. However, you may not call your creations
@@ -58,16 +56,22 @@
from CPAN".
-->
-<script type="text/javascript" charset="utf-8">
+<script src="/local/site.js" charset="utf-8"></script>
+<script>
function focusField() {
document.getElementById("searchfield").focus();
}
- onload = focusField;
+ function hostedby () {
+ span = document.getElementById('hostedby') ;
+ if ( typeof site_img !== 'undefined' ) {
+ span.innerHTML = 'Mirror hosted by <a href="'
+ + site_url + '">' + '<img src="' + site_img + '"></a>' ;
+ }
+ }
</script>
-
</head>
-<body class="section_home">
+<body class="section_home" onload="focusField() ; hostedby()">
<table id="wrapper" border="0" width="95%" cellspacing="0" cellpadding="2"
align="center">
<tr>
@@ -229,6 +233,9 @@
<a href="https://www.fastly.com/"><img alt="Fastly" height="49"
width="118"
src="misc/images/fastly.png" /></a>
</p>
+ <p>
+ <span id="hostedby"></span>
+ </p>
</div>