316 lines
9.7 KiB
HTML
Raw Normal View History

2021-05-23 23:14:53 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
2021-06-28 22:49:25 +02:00
<title>{{ title }}</title>
2021-05-23 23:14:53 +02:00
<link rel="icon" type="image/png" href="favicon.png">
<meta name="theme-color" content="#3c790a">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
<meta name="author" content="Tu nombre">
2021-06-28 22:49:25 +02:00
<meta name="generator" content="RSSpaper">
2021-05-23 23:14:53 +02:00
<meta name="keywords" content="html, css, javascript">
2021-06-28 22:49:25 +02:00
<meta name="description" content="My news">
2021-05-23 23:14:53 +02:00
<meta property="og:image" content="img/screenshot.png">
<meta property="og:title" content="The Rock">
<meta property="og:type" content="website">
<meta property="og:url" content="">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@cuenta">
<meta name="twitter:creator" content="@cuenta">
<meta property="og:image:secure_url" content="https://...">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="300">
<meta property="og:image:alt" content="">
2021-06-28 22:49:25 +02:00
<!-- Normalize -->
2021-05-23 23:14:53 +02:00
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
2021-06-28 22:49:25 +02:00
<!-- End Normalize -->
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">
<!-- End Fonts -->
2021-05-23 23:14:53 +02:00
<!-- CSS -->
2021-06-28 22:49:25 +02:00
<style>
/* Global */
:root {
--color-black: black;
2021-07-01 21:59:50 +02:00
--color-gray: gray;
2021-07-07 00:43:45 +02:00
--height-img: 10rem;
2021-06-28 22:49:25 +02:00
}
body {
margin: 0;
padding: 0;
font-family: 'Newsreader', serif;
color: var(--color-black);
}
2021-07-01 21:08:49 +02:00
img {
object-fit: cover;
object-position: center;
}
2021-06-28 22:49:25 +02:00
img, video, iframe {
width: 100%;
}
a {
color: var(--color-black);
text-decoration: none;
}
pre {
overflow-x: auto;
}
.container {
max-width: 62rem;
margin: 0 auto;
padding: 1rem;
}
2021-07-01 21:08:49 +02:00
.header {
margin-bottom: 2rem;
}
2021-06-28 22:49:25 +02:00
.title {
text-align: center;
font-size: 4rem;
font-weight: normal;
margin-bottom: 0;
margin-top: 1rem;
}
.subtitle {
display: flex;
justify-content: center;
align-items: center;
margin-top: -1rem;
font-weight: normal;
font-size: 1.5rem;
}
.subtitle__separator {
font-size: 3rem;
font-weight: bold;
}
.separator {
border: 0;
background: var(--color-black);
height: 1px;
}
.footer__text {
text-align: center;
padding: 1rem 0;
}
.footer__link {
font-weight: bold;
}
.footer__heard {
display: inline-block;
margin-left: .3rem;
}
.article__title, .article__feed {
font-weight: normal;
}
2021-07-18 13:12:59 +02:00
2021-07-07 00:43:45 +02:00
.article__header-img > a > img {
height: var(--height-img);
object-position: center;
object-fit: contain;
}
.article__random-background {
2021-07-18 13:12:59 +02:00
height: 100%;
2021-07-07 00:43:45 +02:00
width: 100%;
}
2021-06-28 22:49:25 +02:00
</style>
2021-05-23 23:14:53 +02:00
<style media="all and (max-width: 600px)">
2021-06-28 22:49:25 +02:00
/* Mobile */
2021-05-23 23:14:53 +02:00
</style>
<style media="all and (min-width: 601px)">
2021-06-28 22:49:25 +02:00
/* Desktop */
2021-07-01 21:08:49 +02:00
.main {
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(12, 1fr);
}
/* First column. */
.feed__article:nth-child(3n-2){
grid-column: 9 / 13;
}
/* Second column */
.feed__article:nth-child(3n+2){
grid-column: 1 / 5;
}
/* Third column */
.feed__article:nth-child(3n+3) {
grid-column: 5 / 9;
}
.article__title {
font-size: 1.5rem;
}
.article__feed {
font-size: 1rem;
}
2021-07-01 21:59:50 +02:00
.article__date {
font-size: .9rem;
color: var(--color-gray);
}
2021-07-01 21:08:49 +02:00
.feed__article:nth-child(1) .article__title {
font-size: 2rem;
}
.feed__article:nth-child(1) .article__feed {
font-size: 1rem;
}
.feed__article:nth-child(1) {
grid-column: 1 / 9;
grid-row: 1 / 4;
text-align: center;
}
.feed__article:nth-child(2) {
grid-column: 9 / 13;
grid-row: 1 / 2;
}
.feed__article:nth-child(3) {
grid-column: 9 / 13;
grid-row: 2 / 3;
}
.feed__article:nth-child(4) {
grid-column: 9 / 13;
grid-row: 3 / 4;
}
.feed__article:nth-child(2) .article__header,
.feed__article:nth-child(3) .article__header,
.feed__article:nth-child(4) .article__header
{
display: flex;
justify-content: space-between;
flex-direction: row-reverse;
grid-gap: 1rem;
}
.article__header > p {
margin: 0;
}
2021-07-03 01:20:35 +02:00
.article__header-img > img {
2021-07-07 00:43:45 +02:00
height: var(--height-img);
2021-07-03 01:20:35 +02:00
}
.feed__article:nth-child(1) .article__header-img > img,
.feed__article:nth-child(2) .article__header-img > img,
.feed__article:nth-child(3) .article__header-img > img,
.feed__article:nth-child(4) .article__header-img > img
{
height: initial;
}
2021-07-01 21:08:49 +02:00
.feed__article:nth-child(2) .article__titles,
.feed__article:nth-child(3) .article__titles,
.feed__article:nth-child(4) .article__titles,
.feed__article:nth-child(2) .article__header-img,
.feed__article:nth-child(3) .article__header-img,
.feed__article:nth-child(4) .article__header-img
{
width: 50%;
}
.feed__article:nth-child(2) .article__title,
.feed__article:nth-child(3) .article__title,
.feed__article:nth-child(4) .article__title
{
font-size: 1.2rem;
}
.feed__article:nth-child(2) .article__feed,
.feed__article:nth-child(3) .article__feed,
.feed__article:nth-child(4) .article__feed
{
font-size: 1rem;
}
.article__main {
position: fixed;
left: -100%;
top: 0;
bottom: 0;
overflow-y: auto;
2021-05-23 23:14:53 +02:00
}
2021-07-18 13:12:59 +02:00
.feed__article:nth-child(1) .article__header {
display: flex;
flex-direction: column;
height: 100%;
}
.feed__article:nth-child(1) .article__header-img {
height: 100%;
2021-07-07 00:43:45 +02:00
}
2021-05-23 23:14:53 +02:00
</style>
<!-- End CSS -->
</head>
<body>
2021-06-28 22:49:25 +02:00
<div class="container">
<header class="header">
<h1 class="title">{{ title }}</h1>
<h2 class="subtitle"><span class="subtitle__separator">~</span> <span class="subtitle__text">My static generate newspaper</span> <span class="subtitle__separator">~</span></h2>
<hr class="separator">
</header>
<main class="main">
2021-07-02 21:29:55 +02:00
{% for article in articles %}
2021-07-07 00:43:45 +02:00
<article class="feed__article article">
2021-07-03 08:40:17 +02:00
<header class="article__header">
<p class="article__header-img">
2021-07-07 00:43:45 +02:00
<a target="_blank" href="{{ article.link }}">
{% if article.cover %}
<img loading="lazy" src="{{ article.cover }}" alt="{{ article.title }}">
{% else %}
<canvas class="article__random-background"></canvas>
{% endif %}
</a>
2021-07-03 08:40:17 +02:00
</p>
<div class="article__titles">
2021-07-07 00:43:45 +02:00
<h1 class="article__title">
<a target="_blank" href="{{ article.link }}">{{ article.title }}</a>
</h1>
<h2 class="article__feed"><a target="_blank" href="{{ article.feed.link }}">{{ article.feed.title }}</a> <span class="article__date">{{ article.published-date-formatter }}</span></h2>
2021-07-03 08:40:17 +02:00
</div>
</header>
<main class="container article__main">
{{ article.description.value|safe }}
</main>
</article>
2021-06-02 07:35:26 +02:00
{% endfor %}
2021-06-28 22:49:25 +02:00
</main>
</div>
<footer class="footer">
<hr class="separator">
<p class="footer__text">
Generated with <a class="footer__link" href="https://github.com/tanrax/RSSpaper">RSSpaper</a> and a lot of <span class="footer__heard">❤️</span>
</p>
</footer>
2021-07-07 00:43:45 +02:00
<script defer>
function getRandomNumber(min, max) {
return Math.random() * (max - min) + min;
}
function getRandomHexColor() {
return '#'.concat(Math.floor(Math.random() * 16777215).toString(16));
}
// Random background
document.querySelectorAll('.article__random-background').forEach((canvas) => {
canvas.style.backgroundImage = `linear-gradient(${getRandomNumber(0, 360)}deg, ${getRandomHexColor()}, ${getRandomHexColor()})`;
});
</script>
2021-05-23 23:14:53 +02:00
</body>
</html>