-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (61 loc) · 2.29 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<html class="no-js" lang="en-US">
<head>
<meta charset="utf-8">
<title>MSU Article Summarization - Homepage Template</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="">
<meta property="og:type" content="">
<meta property="og:url" content="">
<meta property="og:image" content="">
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
<link rel="stylesheet" href="css/main.css">
<meta name="theme-color" content="#fafafa">
</head>
<body>
<!-- Add your site or application content here -->
<section aria-labelledby="sectionHeading" typeof="CollectionPage" resource="#page">
<header role="banner" aria-label="site header including title and navigation">
<h1 class="mainHeading" id="sectionHeading"><span>MSU Article Summarization</span>
<nav class="controls" role="navigation"><a href="index.html" title="home">home</a> <a href="about.html" title="about">about</a> <a href="sitemap.html" title="sitemap">sitemap</a></nav>
</h1>
</header>
<main>
</main>
<aside>
<!--Site Metadata : Date, Author, DOI/URL -->
</aside>
<footer>
</footer>
</section>
<script>
const RSS_URL = `https://cors-anywhere.herokuapp.com/https://raw.githubusercontent.com/msulibrary/msu-article-summarization/main/sitemap.xml`;
fetch(RSS_URL)
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(data => {
console.log(data);
const items = data.querySelectorAll("item");
let html = ``;
items.forEach(el => {
html += `
<article>
<h2>
<a href="${el.querySelector("link").innerHTML}" target="_blank" rel="noopener">
${el.querySelector("title").innerHTML}
</a>
</h2>
<p>priority:${el.querySelector("priority").innerHTML} frequency:${el.querySelector("changefreq").innerHTML}</p>
<time datetime="${el.querySelector("pubDate").innerHTML}" alt="">${el.querySelector("pubDate").innerHTML}</time>
</article>
`;
});
let baseElement = document.querySelector("main");
baseElement.insertAdjacentHTML("beforeend", html);
});
</script>
</body>
</html>