refactor includes

This commit is contained in:
Max Böck 2019-04-13 21:52:35 +02:00
parent e10b0d9fbd
commit 5eb1046078
8 changed files with 50 additions and 31 deletions

View file

@ -1,7 +1,7 @@
{
"title": "An Example Webring",
"description": "Lorem Ipsum dolor, this is a webring about community XY.",
"url": "https://webring.mxb.dev",
"url": "https://webrings.netlify.com",
"repo": "https://github.com/maxboeck/webring",
"admins": [
{

View file

@ -1,7 +0,0 @@
<ul class="adminlist">
{% for admin in meta.admins %}
<li>
<a href="{{ admin.url }}">{{ admin.name }}</a>
</li>
{% endfor %}
</ul>

View file

@ -1,7 +0,0 @@
<ol class="memberlist">
{% for member in members %}
<li>
<a href="{{ member.url }}">{{ member.title }}</a>
</li>
{% endfor %}
</ol>

15
src/includes/webring.njk Normal file
View file

@ -0,0 +1,15 @@
<div class="webring">
<h1 class="webring__title">{{ meta.title }}</h1>
<p class="webring__desc">{{ meta.description }}</p>
<div class="webring__members">
<h2>Members ({{ members | length }})</h2>
<ol class="memberlist">
{% for member in members %}
<li class="memberlist__item">
<a href="{{ member.url }}" class="memberlist__link">{{ member.title }}</a>
</li>
{% endfor %}
</ol>
</div>
</div>

View file

@ -6,7 +6,15 @@ layout: home
## How to join
## Want to host your own webring?
To add a new site to the webring, [open a pull request]({{ meta.repo }}/compare) and supply the following information:
* Name of your site
* URL of your site
* URL of your RSS feed (optional)
The webring admins will then look at your site and determine if it will be included.
## Add the Snippet
```html
<a href="{{ meta.url }}/prev">Previous</a>
@ -14,3 +22,14 @@ layout: home
<a href="{{ meta.url }}/next">Next</a>
```
## Want to host your own webring?
If you want to start your own webring, here's how to do it:
1. [Fork this Project](https://github.com/maxboeck/webring) on Github
2. Fill in your webring's name and description, and add a code of conduct.
3. [Deploy it to Netlify](https://app.netlify.com/start/deploy?repository=https://github.com/maxboeck/webring)
4. Edit the metadata and provide your Netlify Domain and the repository's URL.
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/maxboeck/webring)

View file

@ -5,12 +5,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ meta.title }}</title>
<title>{{ title or meta.title }}</title>
<link rel="stylesheet" href="{{ '/assets/styles/main.css' | url }}">
<link type="application/atom+xml" rel="alternate" href="feeds.xml" title="{{ meta.title }}">
</head>
<body>
{{ content | safe }}
<div class="container">
{{ content | safe }}
</div>
</body>
</html>

View file

@ -2,14 +2,8 @@
layout: base
---
<h1>{{ meta.title }}</h1>
{% include 'webring.njk' %}
<p>{{ meta.description }}</p>
<h2>Members ({{ members | length }})</h2>
{% include 'memberlist.njk' %}
<h2>Admins ({{ meta.admins | length }})</h2>
{% include 'adminlist.njk' %}
{{ content | safe }}
<div class="markdown">
{{ content | safe }}
</div>

View file

@ -1,7 +1,9 @@
---
layout: base
---
<h1>{{ title }}</h1>
<div>
{{ content | safe }}
<div class="page">
<h1 class="page__title">{{ title }}</h1>
<div class="page__body markdown">
{{ content | safe }}
</div>
</div>