a bit of stuff
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
import { html } from "@mastrojs/mastro";
|
import { html } from "@mastrojs/mastro";
|
||||||
|
|
||||||
export const Footer = () =>
|
export const Footer = () => html`
|
||||||
html`
|
<footer>
|
||||||
<footer>
|
<div>
|
||||||
<div>
|
Made with
|
||||||
Check us out
|
<a href="https://github.com/mastrojs/mastro">Mastro</a> ©
|
||||||
<a href="https://github.com/mastrojs/mastro">on GitHub</a>.
|
${new Date().getFullYear()}
|
||||||
© ${new Date().getFullYear()}
|
</div>
|
||||||
</div>
|
</footer>
|
||||||
</footer>
|
`;
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,28 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Hello World
|
title: Hello World
|
||||||
date: 2024-01-30
|
date: 2026-02-13
|
||||||
---
|
---
|
||||||
|
|
||||||
Markdown is just a simpler syntax for the most commonly used HTML
|
TODO...
|
||||||
elements when writing body text.
|
|
||||||
|
|
||||||
A blank line, like above, marks a new paragraph (HTML `<p>`).
|
|
||||||
A line starting with `##` is an HTML `<h2>`:
|
|
||||||
|
|
||||||
## Lists
|
|
||||||
|
|
||||||
An example of an unordered list:
|
|
||||||
|
|
||||||
- item one
|
|
||||||
- item two
|
|
||||||
|
|
||||||
And an ordered list:
|
|
||||||
|
|
||||||
1. item one
|
|
||||||
2. item two
|
|
||||||
|
|
||||||
|
|
||||||
## More info
|
|
||||||
|
|
||||||
See [CommonMark](https://commonmark.org) for more
|
|
||||||
information about Markdown.
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
title: Second Post
|
|
||||||
date: 2024-01-31
|
|
||||||
---
|
|
||||||
|
|
||||||
This is our second blog post.
|
|
||||||
@@ -1,88 +1,32 @@
|
|||||||
import { html, htmlToResponse } from "@mastrojs/mastro";
|
import { html, htmlToResponse } from "@mastrojs/mastro";
|
||||||
import { Layout } from "../components/Layout.ts";
|
import { Layout } from "../components/Layout.ts";
|
||||||
|
import { readMarkdownFiles } from "@mastrojs/markdown";
|
||||||
|
|
||||||
export const GET = () =>
|
export const GET = async () => {
|
||||||
htmlToResponse(
|
const posts = await readMarkdownFiles("data/posts/*.md");
|
||||||
|
|
||||||
|
return htmlToResponse(
|
||||||
Layout({
|
Layout({
|
||||||
title: "Home",
|
title: "Home",
|
||||||
children: html`
|
children: html`
|
||||||
<nav>
|
<!-- <nav> -->
|
||||||
<p>👉 <a href="/news/">News</a></p>
|
<!-- <p><a href="/posts/">Posts</a></p> -->
|
||||||
</nav>
|
<!-- </nav> -->
|
||||||
|
|
||||||
<h1>Common HTML elements</h1>
|
<h2>About me</h2>
|
||||||
<p>
|
<p>I am a (human) developer.</p>
|
||||||
Let's go through the most important HTML elements to
|
|
||||||
structure your content:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h2>Paragraphs</h2>
|
<h2>Posts</h2>
|
||||||
<p>The p element marks a paragraph of text.</p>
|
<div class="post-list">
|
||||||
|
${posts.map(
|
||||||
<h2>Headings</h2>
|
(post) => html`
|
||||||
<p>
|
<a href="posts/${post.path.slice(12, -3) + "/"}">
|
||||||
At the very top of the body, we have the heading of this page
|
${post.meta.title}
|
||||||
in an h1 element. This is what search engines (like Google)
|
</a>
|
||||||
and screen readers (used by visually impaired readers) look for
|
`,
|
||||||
when they want to know what the page's title is. Therefore, you
|
)}
|
||||||
should only ever have one h1 element on any given page.
|
</div>
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The h2 element is a sub-heading. HTML has h1 up to h6 elements,
|
|
||||||
to mark progressively deeper nested sub-headings. You should
|
|
||||||
use those to mark the structure of your page. All headings
|
|
||||||
together should act like a table of contents for your page.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h2>Lists</h2>
|
|
||||||
<p>
|
|
||||||
Let's add an ordered list
|
|
||||||
(meaning the list markers will be numbers):
|
|
||||||
</p>
|
|
||||||
<ol>
|
|
||||||
<li>list item one</li>
|
|
||||||
<li>list item two</li>
|
|
||||||
<li>list item three</li>
|
|
||||||
</ol>
|
|
||||||
<p>
|
|
||||||
and an unordered list
|
|
||||||
(the list markers will be bullet points):
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li>list item one</li>
|
|
||||||
<li>list item two</li>
|
|
||||||
<li>list item three</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2>Formatting</h2>
|
|
||||||
<p>
|
|
||||||
Note how all elements introduced so far cause a line-break
|
|
||||||
before and after them? That's because they are so-called
|
|
||||||
<a href="https://developer.mozilla.org/en-US/docs/Glossary/Block-level_content">block elements</a>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
However, links (like the a element we just saw),
|
|
||||||
<em>emphasis</em> (rendered as italics), and
|
|
||||||
<strong>strong emphasis</strong> (rendered bold),
|
|
||||||
are all inline elements. That means they don't cause
|
|
||||||
any line-breaks by default.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h2>An image</h2>
|
|
||||||
<img src="chair.jpg" alt="A chair" height="300">
|
|
||||||
<p>
|
|
||||||
We will add an image file <code>chair.jpg</code> later.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
For now, note the alt attribute on the image. It is required
|
|
||||||
and contains "alternative text" that is read to visually
|
|
||||||
impaired readers, or shown if the image fails to load.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
If the image is relevant content, the alt text should
|
|
||||||
therefore be a brief description of what's in the image.
|
|
||||||
If the image is just decoration, you should use alt="".
|
|
||||||
</p>
|
|
||||||
`,
|
`,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,15 +6,13 @@ export const GET = async () => {
|
|||||||
const posts = await readMarkdownFiles("data/posts/*.md");
|
const posts = await readMarkdownFiles("data/posts/*.md");
|
||||||
return htmlToResponse(
|
return htmlToResponse(
|
||||||
Layout({
|
Layout({
|
||||||
title: "News",
|
title: "Posts",
|
||||||
children: posts.map((post) =>
|
children: posts.map(
|
||||||
html`
|
(post) => html`
|
||||||
<p>
|
<p>
|
||||||
<a href="${post.path.slice(12, -3) + "/"}">
|
<a href="${post.path.slice(12, -3) + "/"}"> ${post.meta.title} </a>
|
||||||
${post.meta.title}
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
`
|
`,
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -80,20 +80,26 @@ h6 {
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
color: var(--main-color);
|
||||||
grid-template-rows: auto 1fr auto;
|
grid-template-rows: auto 1fr auto;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
font-family: Helvetica, Arial, sans-serif;
|
font-family: Helvetica, Arial, sans-serif;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
--brand-color: rebeccapurple;
|
|
||||||
|
--brand-bg-color: darkslateblue;
|
||||||
|
--brand-color: lavenderblush;
|
||||||
|
|
||||||
|
background-color: lavenderblush;
|
||||||
|
--main-color: #222;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
background-color: var(--brand-color);
|
background-color: var(--brand-bg-color);
|
||||||
color: whitesmoke;
|
color: var(--brand-color);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
padding: 1.5em 1em 1em 1em;
|
/* padding: 1.5em 0em 0em 1em; */
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
@@ -101,14 +107,15 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
background-color: var(--brand-color);
|
background-color: var(--brand-bg-color);
|
||||||
color: whitesmoke;
|
color: var(--brand-color);
|
||||||
padding: 2em 1em;
|
padding: 1em;
|
||||||
margin-top: 3em;
|
margin-top: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
header > div,
|
header > div,
|
||||||
@@ -119,11 +126,30 @@ footer > div {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
header > a,
|
header a,
|
||||||
a:visited {
|
footer a,
|
||||||
color: white;
|
header a:visited,
|
||||||
|
footer a:visited {
|
||||||
|
color: var(--brand-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--main-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration-line: none;
|
text-decoration-line: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@view-transition {
|
||||||
|
navigation: auto;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user