diff options
initial commit
Diffstat (limited to 'src')
-rw-r--r-- | src/about.md | 8 | ||||
-rw-r--r-- | src/blog.njk | 19 | ||||
-rw-r--r-- | src/css.11ty.js | 37 | ||||
-rw-r--r-- | src/data/err.json | 166 | ||||
-rw-r--r-- | src/data/metadata.json | 12 | ||||
-rw-r--r-- | src/data/navigator.json | 14 | ||||
-rw-r--r-- | src/error.md | 12 | ||||
-rw-r--r-- | src/feed.njk | 27 | ||||
-rw-r--r-- | src/index.css | 62 | ||||
-rw-r--r-- | src/index.md | 11 | ||||
-rw-r--r-- | src/js.11ty.js | 35 | ||||
-rw-r--r-- | src/layouts/base.njk | 29 | ||||
-rw-r--r-- | src/layouts/post.njk | 12 | ||||
-rw-r--r-- | src/post/hello_world.md | 8 | ||||
-rw-r--r-- | src/post/post.json | 3 | ||||
-rw-r--r-- | src/prism.css | 130 | ||||
-rw-r--r-- | src/robot.njk | 7 | ||||
-rw-r--r-- | src/sitemap.njk | 15 |
18 files changed, 607 insertions, 0 deletions
diff --git a/src/about.md b/src/about.md new file mode 100644 index 0000000..4524f7a --- /dev/null +++ b/src/about.md @@ -0,0 +1,8 @@ +--- +layout: base.njk +title: About Me +tags: + - navigator +--- +# About Me + diff --git a/src/blog.njk b/src/blog.njk new file mode 100644 index 0000000..d2ac3e7 --- /dev/null +++ b/src/blog.njk @@ -0,0 +1,19 @@ +--- +layout: base.njk +title: Blog +tags: + - navigator +--- +<ul style="list-style-type:none"> +{% for post in collections.posts %} +<li> + <h1> + <a href="{{ post.url | url }}">{{ post.data.title }}</a> + </h1> + <small> + <p>{{ metadata.author.name }} - {{ post.data.date | datefmt }}<p> + </small> + <p>{{ post.data.description }}<p> +</li> +{% endfor %} +</ul> diff --git a/src/css.11ty.js b/src/css.11ty.js new file mode 100644 index 0000000..a3ef254 --- /dev/null +++ b/src/css.11ty.js @@ -0,0 +1,37 @@ +const fs = require('fs') +const path = require('path') +const postcss = require('postcss') + +module.exports = class { + async data() { + return { + inputs: [ + 'index.css', + 'prism.css' + ], + + pagination: { + data: 'inputs', + alias: 'inputfiles', + size: 1 + }, + + permalink: ({ inputfiles }) => `/${inputfiles}`, + + eleventyExcludeFromCollections: true + } + }; + + async render({ inputfiles}) { + const inputfile = path.join(__dirname, inputfiles); + return await postcss([ + require('postcss-import'), + require('autoprefixer'), + require('cssnano') + ]) + .process(await fs.readFileSync(inputfile), { + from: inputfile + }) + .then(result => result.css) + }; +} diff --git a/src/data/err.json b/src/data/err.json new file mode 100644 index 0000000..87e3603 --- /dev/null +++ b/src/data/err.json @@ -0,0 +1,166 @@ +[ + { + "code": "offline", + "msg": "The Page is offline" + }, + { + "code": 400, + "msg": "Bad Request" + }, + { + "code": 401, + "msg": "Unauthorized" + }, + { + "code": 402, + "msg": "Payment Required" + }, + { + "code": 403, + "msg": "Forbidden" + }, + { + "code": 404, + "msg": "Not Found" + }, + { + "code": 405, + "msg": "Method Not Allowed" + }, + { + "code": 406, + "msg": "Not Acceptable" + }, + { + "code": 407, + "msg": "Proxy Authentication Required" + }, + { + "code": 408, + "msg": "Request Timeout" + }, + { + "code": 409, + "msg": "Conflict" + }, + { + "code": 410, + "msg": "Gone" + }, + { + "code": 411, + "msg": "Length Required" + }, + { + "code": 412, + "msg": "Precondition Failed" + }, + { + "code": 413, + "msg": "Payload Too Large" + }, + { + "code": 414, + "msg": "URI Too Long" + }, + { + "code": 415, + "msg": "Unsupported Media Type" + }, + { + "code": 416, + "msg": "Range Not Satisfiable" + }, + { + "code": 417, + "msg": "Expectation Failed" + }, + { + "code": 418, + "msg": "I\"m a teapot" + }, + { + "code": 421, + "msg": "Misdirected Request" + }, + { + "code": 422, + "msg": "Unprocessable Entity" + }, + { + "code": 423, + "msg": "Locked" + }, + { + "code": 424, + "msg": "Failed Dependency" + }, + { + "code": 425, + "msg": "Too Early" + }, + { + "code": 426, + "msg": "Upgrade Required" + }, + { + "code": 428, + "msg": "Precondition Required" + }, + { + "code": 429, + "msg": "Too Many Requests" + }, + { + "code": 431, + "msg": "Request Header Fields Too Large" + }, + { + "code": 451, + "msg": "Unavailable For Legal Reasons" + }, + { + "code": 500, + "msg": "Internal Server Error" + }, + { + "code": 501, + "msg": "Not Implemented" + }, + { + "code": 502, + "msg": "Bad Gateway" + }, + { + "code": 503, + "msg": "Service Unavailable" + }, + { + "code": 504, + "msg": "Gateway Timeout" + }, + { + "code": 505, + "msg": "HTTP Version Not Supported" + }, + { + "code": 506, + "msg": "Variant Also Negotiates" + }, + { + "code": 507, + "msg": "Insufficient Storage" + }, + { + "code": 508, + "msg": "Loop Detected" + }, + { + "code": 510, + "msg": "Not Extended" + }, + { + "code": 511, + "msg": "Network Authentication Required" + } +]
\ No newline at end of file diff --git a/src/data/metadata.json b/src/data/metadata.json new file mode 100644 index 0000000..e2d7d6c --- /dev/null +++ b/src/data/metadata.json @@ -0,0 +1,12 @@ +{ + "title": "Sudomsg", + "url": "https://sudomsg.xyz/", + "language": "en-GB", + "description": "Messages from root", + "feed": "/feed.xml", + "author": { + "name": "Marc Pervaz Boocha", + "email": "mboocha@sudomsg.xyz", + "url": "https://sudomsg.xyz/about" + } +} diff --git a/src/data/navigator.json b/src/data/navigator.json new file mode 100644 index 0000000..5fb27a7 --- /dev/null +++ b/src/data/navigator.json @@ -0,0 +1,14 @@ +[ + { + "url": "/", + "title": "Home" + }, + { + "url": "/blog/", + "title": "Blog" + }, + { + "url": "/about/", + "title": "About" + } +] diff --git a/src/error.md b/src/error.md new file mode 100644 index 0000000..a84fe07 --- /dev/null +++ b/src/error.md @@ -0,0 +1,12 @@ +--- +layout: base.njk +pagination: + data: err + size: 1 + alias: error +permalink: "/{{ error.code }}.html" +eleventyExcludeFromCollections: true +--- +# ERROR: {{ error.code }} {.err} + +{{ error.msg }} diff --git a/src/feed.njk b/src/feed.njk new file mode 100644 index 0000000..120c33b --- /dev/null +++ b/src/feed.njk @@ -0,0 +1,27 @@ +--- +permalink: /feed.xml +eleventyExcludeFromCollections: true +--- +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <title>{{ metadata.title }}</title> + <subtitle>{{ metadata.description }}</subtitle> + <link href="{{ permalink | url | absoluteUrl(metadata.url) }}" rel="self"/> + <link href="{{ "/" | url | absoluteUrl(metadata.url) }}"/> + <updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated> + <id>{{ metadata.url }}</id> + <author> + <name>{{ metadata.author.name }}</name> + <email>{{ metadata.author.email }}</email> + </author> + {% for post in collections.posts %} + {% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %} + <entry> + <title>{{ post.data.title }}</title> + <link href="{{ absolutePostUrl }}"/> + <updated>{{ post.date | dateToRfc3339 }}</updated> + <id>{{ '/' | url | absoluteUrl(metadata.url) }}</id> + <content type="html">{{ post.templateContent | htmlToAbsoluteUrls( absolutePostUrl ) }}</content> + </entry> + {% endfor %} +</feed> diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..a55d276 --- /dev/null +++ b/src/index.css @@ -0,0 +1,62 @@ +:root { + font-family: sans-serif; +} + +@media screen { + + body { + max-width: 920px; + margin: auto; + padding: 0.5rem; + } + + :any-link { + color: inherit; + text-decoration: underline; + } + + .menu :any-link { + text-decoration: inherit; + } + + .menu ul { + background: darkred; + color: white; + padding: 1rem; + font-size: 1rem; + } + + .menu li { + display: inline; + margin-right: 1rem; + padding-left: 0rem; + padding-right: 0rem; + } + + .err { + color: darkred; + } + + @media (prefers-color-scheme: dark) { + :root { + background: black; + color: white; + } + + .menu ul { + background: red; + } + + .err { + color: red; + } + + } +} + +@media print { + header,nav,footer{ + display:none; + } +} + diff --git a/src/index.md b/src/index.md new file mode 100644 index 0000000..01346a5 --- /dev/null +++ b/src/index.md @@ -0,0 +1,11 @@ +--- +layout: base.njk +title: Home +tags: + - navigator +--- + +# About This Blog + +This is my special place on the big World Wide Web + diff --git a/src/js.11ty.js b/src/js.11ty.js new file mode 100644 index 0000000..b4b04c7 --- /dev/null +++ b/src/js.11ty.js @@ -0,0 +1,35 @@ +const fs = require('fs') +const path = require('path') +const postcss = require('postcss') + +module.exports = class { + async data() { + return { + inputs: [ + ], + + pagination: { + data: 'inputs', + alias: 'inputfiles', + size: 1 + }, + + permalink: ({ inputfiles }) => `/${inputfiles}.css`, + + eleventyExcludeFromCollections: true + } + }; + + async render({ inputfiles}) { + const inputfile = path.join(__dirname, inputfiles); + return await postcss([ + require('postcss-import'), + require('autoprefixer'), + require('cssnano') + ]) + .process(await fs.readFileSync(inputfile), { + from: inputfile + }) + .then(result => result.css) + }; +} diff --git a/src/layouts/base.njk b/src/layouts/base.njk new file mode 100644 index 0000000..10e448f --- /dev/null +++ b/src/layouts/base.njk @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html lang="en-GB"> + <head> + <meta charset="utf-8"> + <title>{{ title or metadata.title }}</title> + <meta name="author" content="{{ metadata.author.name }}"> + <meta name="description" content="{{ description or metadata.description }}"> + <meta name="generator" contents="eleventy"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link async rel="icon" href="{{ '/favicon.svg' | url }}" type="image/svg+xml"> + <link rel="alternate" href="{{ metadata.feed | url }}" type="application/atom+xml" title="{{ metadata.title }}"> + <link rel="canonical" href="{{ page.url | url | absoluteUrl(metadata.url) }}"/> + <link as="style" href="{{ '/index.css' | url }}" rel="stylesheet"/> + <link as="style" href="{{ '/prism.css' | url }}" rel="stylesheet"> + </head> + <body> + <header> + <nav class="menu"><ul> + {% for nav in navigator %} + <li><a href="{{ nav.url | url }}">{{ nav.title }}</a></li> + {% endfor %} + </ul></nav> + </header> + <main> + {{ content | safe }} + </main> + </body> +</html> + diff --git a/src/layouts/post.njk b/src/layouts/post.njk new file mode 100644 index 0000000..b2eb5e5 --- /dev/null +++ b/src/layouts/post.njk @@ -0,0 +1,12 @@ +--- +layout: base.njk +tags: + - posts +--- +<article> + <h1>{{ title }}</h1> + <small> + <time datetime="{{ date | datefmt }}">{{ date | datefmt }}</time> - {{ metadata.author.name }} + </small> + {{ content | safe }} +</article> diff --git a/src/post/hello_world.md b/src/post/hello_world.md new file mode 100644 index 0000000..923ad0b --- /dev/null +++ b/src/post/hello_world.md @@ -0,0 +1,8 @@ +--- +title: Hello World +description: The First Post to the World +date: 2021-09-12 +--- +This is the first post on my blog. + +Eleventy is super fresh init. diff --git a/src/post/post.json b/src/post/post.json new file mode 100644 index 0000000..60ff6df --- /dev/null +++ b/src/post/post.json @@ -0,0 +1,3 @@ +{ + "layout": "post.njk" +}
\ No newline at end of file diff --git a/src/prism.css b/src/prism.css new file mode 100644 index 0000000..431fe8a --- /dev/null +++ b/src/prism.css @@ -0,0 +1,130 @@ +code[class*="language-"],pre[class*="language-"] { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0, 0, 0, 0.3); + font-family: monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + tab-size: 4; + hyphens: none; +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + border-radius: 0.3em; +} + +:not(pre) > code[class*="language-"],pre[class*="language-"] { + background: #272822; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment,.token.prolog,.token.doctype,.token.cdata { + color: #8292a2; +} + +.token.punctuation { + color: #f8f8f2; +} + +.token.namespace { + opacity: .7; +} + +.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted { + color: #f92672; +} + +.token.boolean,.token.number { + color: #ae81ff; +} + +.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted { + color: #a6e22e; +} + +.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable { + color: #f8f8f2; +} + +.token.atrule,.token.attr-value,.token.function,.token.class-name { + color: #e6db74; +} + +.token.keyword { + color: #66d9ef; +} + +.token.regex,.token.important { + color: #fd971f; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +@media screen and (prefers-color-scheme: dark){ + code[class*="language-"],pre[class*="language-"] { + color: black; + text-shadow: 0 1px white; + } + + :not(pre) > code[class*="language-"], pre[class*="language-"] { + background: #f5f2f0; + } + + .token.comment,.token.prolog,.token.doctype,.token.cdata { + color: slategray; + } + + .token.punctuation { + color: #999; + } + + .token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol,.token.deleted { + color: #905; + } + + .token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted { + color: #690; + } + + .token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5); + } + + .token.atrule,.token.attr-value,.token.keyword { + color: #07a; + } + + .token.function,.token.class-name { + color: #DD4A68; + } + + .token.regex,.token.important,.token.variable { + color: #e90; + } +}
\ No newline at end of file diff --git a/src/robot.njk b/src/robot.njk new file mode 100644 index 0000000..79c49c0 --- /dev/null +++ b/src/robot.njk @@ -0,0 +1,7 @@ +--- +permalink: /robot.txt +eleventyExcludeFromCollections: true +--- +User-agent: * +Allow: / +Sitemap: {{ "/"| url | absoluteUrl(metadata.url) }}/sitemap.xml
\ No newline at end of file diff --git a/src/sitemap.njk b/src/sitemap.njk new file mode 100644 index 0000000..b2ff291 --- /dev/null +++ b/src/sitemap.njk @@ -0,0 +1,15 @@ +--- +permalink: /sitemap.xml +eleventyExcludeFromCollections: true +--- +<?xml version="1.0" encoding="utf-8"?> +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> +{%- for page in collections.all %} + {% set absoluteUrl %}{{ page.url | url | absoluteUrl(metadata.url) }}{% endset %} + <url> + <loc>{{ absoluteUrl }}</loc> + <lastmod>{{ page.date | datefmt }}</lastmod> + </url> +{%- endfor %} +</urlset> + |