Skip to content

Commit

Permalink
Blog posts can be external links (#71)
Browse files Browse the repository at this point in the history
* add ability for blog posts to link to external sites

* adjust review blog, placeholder for roanoke star

* add external icon to external blog review link

* temp remove placeholder external review
  • Loading branch information
reedcodes authored Mar 10, 2023
1 parent 48698ac commit c5584af
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/_config/collections/blog-posts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = function( collection ) {
return [...collection.getFilteredByGlob( "./source/blog/post/*/*.md" )].reverse();
return [...collection.getFilteredByGlob( "./source/blog/*/**/*.md" )].reverse();
};
4 changes: 4 additions & 0 deletions source/_includes/icons/external.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions source/_includes/post/header.njk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<{{- post_title_heading }} class="post-title">
{%- if post_title_link -%}<a class="post-title-link" href="{{- post_url -}}">{%- endif -%}
{{ post_title }}

{%- if post.data.external -%}
{%- include "icons/external.svg" -%}
{%- endif -%}

{%- if post_title_link -%}</a>{%- endif -%}
</{{- post_title_heading -}}>

Expand Down
2 changes: 1 addition & 1 deletion source/_includes/post/list.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{%- for post in post_list -%}
{%- set post_feature = post.data.feature -%}
{%- set post_date = post.data.date -%}
{%- set post_url = post.url -%}
{%- set post_url = (post.data.external if post.data.external else post.url) -%}
{%- set post_title = post.data.title -%}
{%- set post_teaser = post.data.teaser -%}
{%- set post_category = post.data.category -%}
Expand Down
13 changes: 13 additions & 0 deletions source/_sass/post/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
padding-block: 5vh;
}

&-header {
.icon-external {
--fillColor: currentColor;

display: inline-block;
max-block-size: 0.6em;
inline-size: auto;
margin-inline-start: 0.25em;
vertical-align: middle;

}
}

&-date {
font-size: 1rem;
}
Expand Down
8 changes: 8 additions & 0 deletions source/blog/review/review.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"layout": "layouts/post.njk",
"permalink": "/blog/review/{{ title | slugify }}/",
"eleventyNavigation": {
"parent": "Blog"
},
"post_title_heading": "h1"
}

0 comments on commit c5584af

Please sign in to comment.