Skip to content

Commit

Permalink
11ty site
Browse files Browse the repository at this point in the history
  • Loading branch information
moiSentineL committed Jan 27, 2024
1 parent 68d8316 commit 861817c
Show file tree
Hide file tree
Showing 24 changed files with 6,281 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { DateTime } = require("luxon");
const markdownIt = require("markdown-it");

module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPassthroughCopy("media");

eleventyConfig.addFilter("formatDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toISODate();
});

let markdownOptions = {
html: true,
breaks: true,
linkify: true
};
let markdownLib = new markdownIt(markdownOptions);

//Add div around tables
markdownLib.renderer.rules.table_open = () => '<div class="table-wrapper">\n<table>\n',
markdownLib.renderer.rules.table_close = () => '</table>\n</div>',

eleventyConfig.setLibrary("md", markdownLib);
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
_site
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Michał Birecki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 11ty-no-style-please
A minimalist blog template for the [eleventy](https://www.11ty.dev/) static site generator.
Inspired by [no-style-please](https://github.com/riggraz/no-style-please).
It has [Netlify CMS](https://www.netlifycms.org/) built in and can deploy to [Netlify](https://www.netlify.com/) in one click so you can start writing posts right away.

---

![Site Screenshot](/site-screenshot.png)
## [Check out the demo page](https://11ty-no-style-please.netlify.app/)

# Features
- Simple design
- Fast, minimal amount of CSS to download
- Pre-configured CMS
- Easy to use and deploy
- Fully responsive

# Usage
The simplest way to use this template is to deploy it on Netlify using this button:

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/stopnoanime/11ty-no-style-please&stack=cms)

After deploying it to Netlify, you will be invited to join the CMS by email.
After accepting the invite and setting a password you can start change the site's settings, and creating posts from within the CMS.

---
You can also run eleventy locally and then deploy it manually:

### 1. Clone the repository ( or use it as a template then clone )

`git clone https://github.com/stopnoanime/11ty-no-style-please`

### 2. Install the required packages

`npm i`

### 3. Serve the site for local development

`npm start`

### 4. Build the site

`npm run build`

### 5. Deploy the site

You can either connect your repository to Netlify to enable automatic deploy (recommended), or manually copy the site files from `_site` to them.

# Configuration
All configuration can be easily changed from within the Netlify CMS at `SITE_URL/admin`.
If you prefer to do so, you can also manually edit the configuration files with a text editor.

All configuration files are located in the `_data` folder and are in `json` format.
Here I describe what each field means:

### - site.json
```
title: default page title
description: global page description
language: HTML language value
back_home_text: text to show on "back home" button on every post
url: site url, used in Netlify CMS
```

### - homepage.json
```
title: homepage title
subtitle: text to show under homepage title
menu: The menu object, configures how the menu looks
```

### - The menu object
It should be an array of entires, each entry has the following parameters:
```
title: entry title
url: if set, the entry is a link pointing to this url
post_list: accepts a string, if set, the entry will show a nested list of all posts with the tag that post_list is set to
entries: an nested array of entries with the same available parameters
```

For example use, look at the default menu object
```
"menu": [
{
"title": "read more here",
"entries": [
{
"title": "github",
"url": "http://github.com/stopnoanime/11ty-no-style-please"
}
]
},
{
"title": "all posts with the 'post' tag",
"post_list": "post"
}
]
```
19 changes: 19 additions & 0 deletions _data/homepage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"title": "Nibir Sankar",
"subtitle": "demo of a page made with 11ty-no-style-please",
"menu": [
{
"title": "read more here",
"entries": [
{
"title": "github",
"url": "http://github.com/stopnoanime/11ty-no-style-please"
}
]
},
{
"title": "all posts with the 'post' tag",
"post_list": "post"
}
]
}
7 changes: 7 additions & 0 deletions _data/site.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "Nibir Sankar",
"description": "a free thinker from Assam, India",
"language": "en",
"back_home_text": "..",
"url": "https://11ty-no-style-please.netlify.com"
}
26 changes: 26 additions & 0 deletions _includes/base.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="{{ site.language }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="{{ eleventy.generator }}">

{% if site.description %}
<meta name="description" content="{{ site.description }}">
{% endif %}
<title>{{ title or site.title }}</title>

<link rel="stylesheet" href="/css/css.css">
{% if page.url == '/' %}
<script>
if(location.hash) window.location = `/admin/#${location.href.split("#").pop()}`
</script>
{% endif %}
</head>
<body>
{{ content | safe }}
</body>
<footer>

</footer>
</html>
121 changes: 121 additions & 0 deletions _includes/homepage.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
layout: base.njk
---
<style type="text/css">
.fcrow{
display: flex;
flex-direction: row;
padding-bottom: 2ch;
}
.name{
padding-bottom: 0rem;
line-height: 0.5;
font-size: 300%;
margin-bottom:0.6em;
}
.this{
padding-bottom: 0rem;
line-height: 0.5;
font-size: 150%;
margin-top: 0rem;
padding-top: 0rem;
margin-bottom:1em;
color: #6e6e6e;
font-weight: 500;
}
.img_deg{
align-self: center;
float: right;
width: 30%;
margin-right: 0.5em;
margin-bottom: 0em;
border-radius: 50%;
}
@media screen and (max-width: 650px) {
.fcrow{
display: flex;
flex-direction: column;
}
.name{
margin-top: 0rem;
padding-top: 0rem;
padding-bottom: 0rem;
margin-bottom: 0.75rem;
line-height: 0.85;
font-size: 200%;
}
.this{
padding-bottom: 0rem;
margin-bottom: 1rem;
line-height: 0.5;
margin-bottom:0.6em;
color: #6e6e6e;
font-weight: 500;
}
.img_deg {
align-self: center;
width: 70%;
margin: auto;
margin-top:1.5em;
margin-bottom: 0em;
border-radius: 50%;
}
}
</style>
<header>
<div class="fcrow">
<div>
<h1 class="name">Nibir Sankar</h1>
<h2 class="this">A <span class="continue"></h2>
<div>
<a href="/">blog</a>
<a href="https://visionoflife.substack.com">newsletter</a>
<a href="/">about me</a>
<a href="https://www.linkedin.com/in/nibirsankar">linkedin</a>
<a href="https://github.com/moiSentineL">github</a>
</div>
</div>
<img src="media/pf.jpg" alt="" class="img_deg" id="int">
</div>


{# {% set subtitle = homepage.subtitle%}
{% if subtitle %}
<p>{{ subtitle }}</p>
{% endif %} #}

<script src="https://unpkg.com/typed.js@2.1.0/dist/typed.umd.js"></script>

<script>
var typed = new Typed('.continue', {
strings: ['thinker?', 'writer?', 'musician?', 'philosopher?', 'creator.'],
typeSpeed: 65,
backSpeed: 40,
backDelay: 1700,
})
</script>
</header>
<main>
<hr>
<p>
Hi there! I am <b>Nibir Sankar</b> from Assam, India. I am currently in High School, searching for a meaningful life.
</p>
<p>
I am a bit ambitious about <b>life</b>, and want to explore and learn new things.
I am really interested in philosophy, theoretical physics, math and literature.
While I am not studying or doing my projects, I enjoy reading, writing, playing music and tweaking my workflows.

</P>
<p>
You can learn more about me and what I am upto now here.
</p>
<p>
You should subscribe to my <a href="https://visionoflife.substack.com">newsletter</a> or you can reach out to me <a href="mailto:nibirsankar26@gmail.com">by mailing me</a>.
<hr>


{# {% set entries = homepage.menu %}
{% include "menu.njk" %} #}
</main>
30 changes: 30 additions & 0 deletions _includes/menu.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<ul>
{% for entry in entries %}
<li>
{% if entry.url %}
<a href="{{ entry.url }}">{{ entry.title }}</a>
{% else %}
{{ entry.title }}
{% endif %}

{% if entry.post_list %}
{% set posts = collections[entry.post_list] %}
{% if posts %}
<ul>
{% for post in posts | reverse %}
<li>
<time datetime="{{ post.date }}">{{ post.date | formatDate }}</time>
<a href="{{ post.url }}">{{ post.data.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}

{% if entry.entries %}
{% set entries = entry.entries %}
{% include "menu.njk" %}
{% endif %}
</li>
{% endfor %}
</ul>
14 changes: 14 additions & 0 deletions _includes/post.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: base.njk
---
<a href="/">{{ site.back_home_text }}</a>

<article>
<p class="post-meta">
<time datetime="{{ page.date }}">{{ page.date | formatDate }}</time>
</p>

<h1>{{ title }}</h1>

{{ content | safe }}
</article>
Loading

0 comments on commit 861817c

Please sign in to comment.