Welcome to "the Stupid YAML Website"

The template is written in YAML, against any and all good sense.

I wanted to experiment with Go and parsing, and this is the result. Surprisingly, its quite easy to use and read... Maybe this is the future of web development?

Anyway, the source code for the server can be found here

You can also see the source YAML for this page below:

head:
  children:
    - title: "Stupid YAML Website" # This is shorthand for children: - raw: "..."
    - link:
        rel: "stylesheet"
        type: "text/css"
        href: "static/style.css"
    - meta:
        name: "viewport"
        content: "width=device-width, initial-scale=1"

# This is an anchor. It behaves slightly differently from normal YAML anchors
# to suit HTML better. The difference is that the value of the anchor is not
# "real", and only gets transpiled when it's aliased.
# See further down in html for an example.
content: &content
  class: "content"
  children:
    - h1:
        class: "title"
        innerText: "Welcome to \"the Stupid YAML Website\"" # This is shorthand for children: - raw: "...". Similar to the title tag above, but when you also want to add attributes
    - div:
        class: "description"
        children:
          - p: "The template is written in YAML, against any and all good sense."
          - p: "I wanted to experiment with Go and parsing, and this is the result. Surprisingly, it's quite easy to use and read... Maybe this is the future of web development?"
          - p:
              children:
                - raw: "Anyway, the source code for the server can be found "
                - a:
                    href: "https://github.com/frodi-karlsson/yaml_tmpl"
                    innerText: "here"
    - div:
        class: "source"
        children:
          - p: "You can also see the source YAML for this page below:"
          - pre: "{{ .YAML }}"
          - p: "And the CSS below this:"
          - pre: "{{ .CSS }}"

html:
  children:
    - body:
      children:
        - div: *content

And the CSS below this:

html, body {
    height: 100%;
}

* {
    box-sizing: border-box;
}

html {
    background: #111;
    height: fit-content;
    line-height: 1.6;
}

body {
    color: #def;
    font-family: 'Helvetica Neue', sans-serif;

    margin: 0;

    overflow: auto;
}

body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

body::-webkit-scrollbar-thumb:hover, pre::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.5);
}

.content {
    padding: 64px calc(max(16px, calc((100vw - 800px) / 2))) 32px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    gap: 64px;

    min-height: 100%;
}

.description {
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    width: 100%;
    background: #2228;
}

a {
    color: #faa;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a:visited {
    color: #d77;
}

@keyframes rainbow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.source {
    width: 100%;
}

pre {
    background:
        linear-gradient(45deg, #7002, #7702, #0702, #0772, #0072, #7072, #7002);
    background-size: 600% 600%;
    animation: rainbow 40s linear infinite;
    padding: 16px;
    overflow: auto;
    width: 100%;

    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);

    transition: transform 0.2s;

    max-height: 50vh;

    font-size: 12px;

    @media (min-width: 800px) {
        font-size: 16px;
    }
}

pre:hover {
    transform: scale(1.01);
}

pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

pre::-webkit-scrollbar-thumb:hover, pre::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.5);
}

pre::-webkit-scrollbar-corner {
    background: transparent;
}

p {
    width: 100%;
    font-size: 14px;

    @media (min-width: 800px) {
        font-size: 20px;
    }
}

h1 {
    font-size: 24px;

    @media (min-width: 800px) {
        font-size: 40px;
    }
    margin: 0;
    padding: 0;

    text-align: center;
}