diff --git a/docs/index.rst b/docs/index.rst
index b1666ee22e..79afae65da 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -65,10 +65,7 @@ Blog Planet
.. raw:: html
-
diff --git a/docs/js/main.js b/docs/js/main.js
index 87b817b287..bb94c5ac52 100644
--- a/docs/js/main.js
+++ b/docs/js/main.js
@@ -89,65 +89,3 @@ function advancedsearch(e) {
return false;
}
-
-function fetchRSS() {
- if (document.location.protocol == "file:")
- return;
-
- var planet = document.getElementById("planet");
- if (planet === null)
- return;
-
- var req = new XMLHttpRequest();
- req.open("GET", "https://planet.virt-tools.org/atom.xml");
- req.setRequestHeader("Accept", "application/atom+xml, text/xml");
- req.onerror = function(e) {
- if (this.statusText != "")
- console.error(this);
- };
- req.onload = function(e) {
- if (this.readyState !== 4)
- return;
-
- if (this.status != 200) {
- console.error(this.statusText);
- return;
- }
-
- if (this.responseXML === null) {
- console.error("Atom response is not an XML");
- return;
- }
-
- var dl = document.createElement("dl");
- var dateOpts = { day: "numeric", month: "short", year: "numeric"};
-
- var entries = this.responseXML.querySelectorAll("feed > entry:not(:nth-of-type(1n+5))");
-
- entries.forEach(function(e) {
- var name = e.querySelector("author > name").textContent;
- var title = e.querySelector("title").textContent;
- var updated = e.querySelector("updated").textContent;
- var link = e.querySelector("link").attributes.href.textContent;
-
- var a = document.createElement("a");
- a.href = link;
- a.innerText = title;
-
- var dt = document.createElement("dt");
- dt.appendChild(a);
- dl.appendChild(dt);
-
- var date = new Date(updated);
- date = date.toLocaleDateString("default", dateOpts);
-
- var dd = document.createElement("dd");
- dd.innerText = ` by ${name} on ${date}`;
-
- dl.appendChild(dd);
- });
-
- planet.appendChild(dl);
- };
- req.send();
-}
diff --git a/docs/js/meson.build b/docs/js/meson.build
index 9f77b0d85c..e83d1c92b0 100644
--- a/docs/js/meson.build
+++ b/docs/js/meson.build
@@ -1,5 +1,6 @@
docs_js_files = [
'main.js',
+ 'virt-tools-blog-planet.js',
]
install_data(docs_js_files, install_dir: docs_html_dir / 'js')
diff --git a/docs/js/virt-tools-blog-planet.js b/docs/js/virt-tools-blog-planet.js
new file mode 100644
index 0000000000..7f4e2bf3b9
--- /dev/null
+++ b/docs/js/virt-tools-blog-planet.js
@@ -0,0 +1,65 @@
+"use strict";
+
+function fetchRSS() {
+ if (document.location.protocol == "file:")
+ return;
+
+ var planet = document.getElementById("planet");
+ if (planet === null)
+ return;
+
+ var req = new XMLHttpRequest();
+ req.open("GET", "https://planet.virt-tools.org/atom.xml");
+ req.setRequestHeader("Accept", "application/atom+xml, text/xml");
+ req.onerror = function(e) {
+ if (this.statusText != "")
+ console.error(this);
+ };
+ req.onload = function(e) {
+ if (this.readyState !== 4)
+ return;
+
+ if (this.status != 200) {
+ console.error(this.statusText);
+ return;
+ }
+
+ if (this.responseXML === null) {
+ console.error("Atom response is not an XML");
+ return;
+ }
+
+ var dl = document.createElement("dl");
+ var dateOpts = { day: "numeric", month: "short", year: "numeric"};
+
+ var entries = this.responseXML.querySelectorAll("feed > entry:not(:nth-of-type(1n+5))");
+
+ entries.forEach(function(e) {
+ var name = e.querySelector("author > name").textContent;
+ var title = e.querySelector("title").textContent;
+ var updated = e.querySelector("updated").textContent;
+ var link = e.querySelector("link").attributes.href.textContent;
+
+ var a = document.createElement("a");
+ a.href = link;
+ a.innerText = title;
+
+ var dt = document.createElement("dt");
+ dt.appendChild(a);
+ dl.appendChild(dt);
+
+ var date = new Date(updated);
+ date = date.toLocaleDateString("default", dateOpts);
+
+ var dd = document.createElement("dd");
+ dd.innerText = ` by ${name} on ${date}`;
+
+ dl.appendChild(dd);
+ });
+
+ planet.appendChild(dl);
+ };
+ req.send();
+}
+
+window.addEventListener("load", function() { fetchRSS() });