From 2db949a45cad6cf78a5ba8c319b12dd58a75a166 Mon Sep 17 00:00:00 2001 From: avitex Date: Tue, 14 Apr 2020 12:23:38 +1000 Subject: [PATCH] fix meta title/desc --- config.toml | 24 ++++++++-------- content/_index.md | 7 ----- sass/_layout.scss | 19 +++++++++++++ sass/_reset.scss | 10 ------- sass/site.scss | 28 +++++++++---------- templates/about.html | 1 - templates/anchor-link.html | 2 +- templates/blog.html | 2 -- templates/blog/categories/list.html | 2 +- templates/blog/categories/single.html | 2 +- templates/blog/post.html | 7 +++-- templates/blog/tags/list.html | 1 + templates/blog/tags/single.html | 2 +- templates/content.html | 10 +++---- templates/index.html | 7 +++-- templates/macros.html | 18 ++++++++++-- templates/page.html | 6 ++-- templates/partials/site-nav.html | 40 ++++++++++++++------------- templates/post_macros.html | 2 +- templates/projects.html | 1 - templates/root.html | 11 ++++++-- 21 files changed, 110 insertions(+), 92 deletions(-) delete mode 100644 content/_index.md create mode 100644 sass/_layout.scss delete mode 100644 sass/_reset.scss diff --git a/config.toml b/config.toml index efdf727..ea92dfe 100644 --- a/config.toml +++ b/config.toml @@ -16,28 +16,28 @@ taxonomies = [ author = "avitex" [[extra.main_menu]] -name = "blog" +name = "Blog" url = "/blog" sub = [ - {name = "latest", url = "/blog"}, - {name = "categories", url = "/blog/categories"}, - {name = "tags", url = "/blog/tags"} + {name = "Latest", url = "/blog"}, + {name = "Categories", url = "/blog/categories"}, + {name = "Tags", url = "/blog/tags"} ] [[extra.main_menu]] -name = "projects" +name = "Projects" url = "/projects" sub = [ - {name = "rust", url = "#rust"}, - {name = "elixir", url = "#elixir"}, - {name = "github", url = "https://github.com/avitex"} + {name = "Rust", url = "#rust"}, + {name = "Elixir", url = "#elixir"}, + {name = "Github", url = "https://github.com/avitex"} ] [[extra.main_menu]] -name = "about" +name = "About" url = "/about" sub = [ - {name = "overview", url = "/about"}, - {name = "bio", url = "/about/bio"}, - {name = "social", url = "/about/social"} + {name = "Overview", url = "/about"}, + {name = "Bio", url = "/about/bio"}, + {name = "Social", url = "/about/social"} ] \ No newline at end of file diff --git a/content/_index.md b/content/_index.md deleted file mode 100644 index 40654df..0000000 --- a/content/_index.md +++ /dev/null @@ -1,7 +0,0 @@ -+++ -insert_anchor_links = "right" -+++ - -My [projects](/projects), [thoughts](/blog), and [me](/about) - -![avitex](/brain-only.png) \ No newline at end of file diff --git a/sass/_layout.scss b/sass/_layout.scss new file mode 100644 index 0000000..75f03eb --- /dev/null +++ b/sass/_layout.scss @@ -0,0 +1,19 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html, body { + height: 100%; + width: 100%; +} + +.container { + width: 100%; + min-width: 600px; + max-width: 900px; + margin-left: auto; + margin-right: auto; + padding-bottom: 2rem; +} diff --git a/sass/_reset.scss b/sass/_reset.scss deleted file mode 100644 index 4420c41..0000000 --- a/sass/_reset.scss +++ /dev/null @@ -1,10 +0,0 @@ -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -html, body { - height: 100%; - width: 100%; -} diff --git a/sass/site.scss b/sass/site.scss index c2b837a..5ae222c 100644 --- a/sass/site.scss +++ b/sass/site.scss @@ -9,7 +9,11 @@ $mono-font: 'Source Code Pro', monospace; $content-font: 'Charter', serif; $heading-font: 'Space Grotesk', Helvetica, sans-serif; -@import './reset'; +$lg-breakpoint: 1024px; +$md-breakpoint: 720px; +$sm-breakpoint: 640px; + +@import './layout'; @import './scrollbar'; @import './header'; @import './search'; @@ -60,11 +64,14 @@ h1, h2, h3 { border-bottom: none; } - a.anchor { + a.anchor{ display: none; - color: $red; - font-weight: bold; - text-decoration: none; + &::after { + color: $red; + content: " #"; + font-weight: bold; + text-decoration: none; + } } &:hover a.anchor { @@ -129,19 +136,10 @@ code { font-size: 0.75em; } -.container { - width: 100%; - min-width: 600px; - max-width: 900px; - margin-left: auto; - margin-right: auto; - padding-bottom: 2rem; -} - .muted { color: $grey; } .mono { font-family: $mono-font; -} \ No newline at end of file +} diff --git a/templates/about.html b/templates/about.html index e8125ba..6221672 100644 --- a/templates/about.html +++ b/templates/about.html @@ -1,3 +1,2 @@ {% extends "content.html" %} - {% block title %}About - {{ config.title }}{% endblock %} \ No newline at end of file diff --git a/templates/anchor-link.html b/templates/anchor-link.html index 1573460..42d326e 100644 --- a/templates/anchor-link.html +++ b/templates/anchor-link.html @@ -1 +1 @@ - # \ No newline at end of file + \ No newline at end of file diff --git a/templates/blog.html b/templates/blog.html index 7110cc8..285b9ef 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -1,8 +1,6 @@ {% extends "content.html" %} {% import "post_macros.html" as post_macros %} - {% block title %}Blog - {{ config.title }}{% endblock %} - {% block content %}
{% for page in paginator.pages %} diff --git a/templates/blog/categories/list.html b/templates/blog/categories/list.html index ff93f6b..69d6621 100644 --- a/templates/blog/categories/list.html +++ b/templates/blog/categories/list.html @@ -1,5 +1,5 @@ {% extends "content.html" %} - +{% block title %}Categories - {{ config.title }}{% endblock %} {% block content %}

Categories

{% if terms %} diff --git a/templates/blog/categories/single.html b/templates/blog/categories/single.html index 7ce816b..c55b8b4 100644 --- a/templates/blog/categories/single.html +++ b/templates/blog/categories/single.html @@ -1,6 +1,6 @@ {% extends "content.html" %} {% import "post_macros.html" as post_macros %} - +{% block title %}Category {{ term.name }} - {{ config.title }}{% endblock %} {% block content %}

Category: {{ term.name }} (RSS)

{% for page in term.pages %} diff --git a/templates/blog/post.html b/templates/blog/post.html index bdb4911..b352ca7 100644 --- a/templates/blog/post.html +++ b/templates/blog/post.html @@ -1,6 +1,7 @@ {% extends "content.html" %} +{% import "macros.html" as macros %} {% import "post_macros.html" as post_macros %} - +{% block title %}{{ page.title }} - {{ config.title }}{% endblock %} {% block content %}
@@ -19,13 +20,13 @@ {% endif %} {% if page.taxonomies | get(key="blog/categories") %} {% set categories = page.taxonomies | get(key="blog/categories") %} - in {{ categories[0] }} + in {{ categories[0] }} {% endif %} {% set tags = page.taxonomies | get(key="blog/tags") %} {% if tags %} and tagged {% for tag in tags %} - {{ tag }} + {{ tag }} {% if tags | length > 1 %} {% if loop.index != tags | length %} {% if loop.index == tags | length - 1 %} diff --git a/templates/blog/tags/list.html b/templates/blog/tags/list.html index 9e00845..a8cc9d0 100644 --- a/templates/blog/tags/list.html +++ b/templates/blog/tags/list.html @@ -1,4 +1,5 @@ {% extends "content.html" %} +{% block title %}Tag - {{ config.title }}{% endblock %} {% block content %}

Tags

{% if terms %} diff --git a/templates/blog/tags/single.html b/templates/blog/tags/single.html index 5c3006e..2b26ac4 100644 --- a/templates/blog/tags/single.html +++ b/templates/blog/tags/single.html @@ -1,6 +1,6 @@ {% extends "content.html" %} {% import "post_macros.html" as post_macros %} - +{% block title %}Tag {{ term.name }} - {{ config.title }}{% endblock %} {% block content %}

Tag: {{ term.name }} (RSS)

{% for page in term.pages %} diff --git a/templates/content.html b/templates/content.html index 6faf930..445c411 100644 --- a/templates/content.html +++ b/templates/content.html @@ -3,13 +3,13 @@ {% block body %}
-
- {% block content %} - {{ section.content | safe }} - {% endblock content %} +
+ {% block content %}{{ section.content | safe }}{% endblock content %}
{% endblock body %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 6ee049c..d665cfa 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,12 +1,13 @@ {% extends "root.html" %} {% import "macros.html" as macros %} {% block title %}{{ config.description }} - {{ config.title }}{% endblock %} +{% block meta_description %}The personal homepage of {{config.extra.author}}{% endblock meta_description %} {% block body %}
- avitex logo + brain logo
-

avitex

+

{{config.extra.author}}

{% include "partials/site-nav.html" %}
-{% endblock body %} \ No newline at end of file +{% endblock body %} diff --git a/templates/macros.html b/templates/macros.html index dff502c..a298adc 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,8 +1,8 @@ {% macro link(url) %} {%- if url is starting_with("/") or url is starting_with("./") -%} - {{ get_url(path=url, trailing_slash=false) }} + {{ get_url(path=url, trailing_slash=false) | safe }} {%- else -%} - {{ url }} + {{ url | safe }} {%- endif -%} {% endmacro link %} @@ -13,3 +13,17 @@ {{ curr_url is starting_with(url) }} {%- endif -%} {% endmacro is_active_nav %} + +{% macro meta_desc(ctx) %} + {%- if ctx.description == "" -%} + {{ ctx.description }} + {%- else -%} + {%- if ctx.summary -%} + {{ ctx.summary | striptags | replace(from=" +", to=" ") | trim }} + {%- else -%} + {{ ctx.content | striptags | replace(from=" +", to=" ") | trim }} + {%- endif -%} + {%- endif -%} +{% endmacro meta_desc %} diff --git a/templates/page.html b/templates/page.html index af64b5b..04eaf62 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,6 +1,4 @@ {% extends "content.html" %} - +{% import "macros.html" as macros %} {% block title %}{{ page.title }} - {{ config.title }}{% endblock %} -{% block content %} - {{ page.content | safe }} -{% endblock content %} \ No newline at end of file +{% block content %}{{ page.content | safe }}{% endblock content %} \ No newline at end of file diff --git a/templates/partials/site-nav.html b/templates/partials/site-nav.html index 49e26ca..e1ddb9e 100644 --- a/templates/partials/site-nav.html +++ b/templates/partials/site-nav.html @@ -1,28 +1,30 @@ \ No newline at end of file diff --git a/templates/post_macros.html b/templates/post_macros.html index 976c230..2ddb714 100644 --- a/templates/post_macros.html +++ b/templates/post_macros.html @@ -26,7 +26,7 @@
{{ page.summary | safe }}