diff --git a/.eleventy.js b/.eleventy.js index d07df14..e6a57d0 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -51,6 +51,7 @@ module.exports = function (eleventyConfig) { eleventyConfig.addPassthroughCopy('src/robots.txt') eleventyConfig.addFilter('postDate', (dateObj) => { + if (typeof (dateObj) !== 'object') dateObj = new Date(dateObj) return DateTime.fromJSDate(dateObj).toLocaleString(DateTime.DATE_MED) }) @@ -75,6 +76,32 @@ module.exports = function (eleventyConfig) { return string.split(' ').splice(0, 12).join(' ') }) + eleventyConfig.addFilter('cutText', (string, size) => { + return string.split('-').splice(0, size).join('-') + }) + + eleventyConfig.addFilter('serializeTitle', (string, yearSplice = 2) => { + const titleParts = string.split('-') + const [year, ...title] = titleParts + const titleInitials = title.map(title => title.split('')[0]).join('') + const yearSuffix = year.slice(-yearSplice) + + return `${yearSuffix}-${titleInitials}` + }) + + eleventyConfig.addFilter('breakLine', (string, cutAt = 3, maxSize = 30) => { + const titleWords = string.split(' ') + const titleLength = string.length + const titlePreview = titleWords.slice(0, cutAt).join(" ") + const titleRemaining = titleWords.slice(cutAt).join(" ") + + const hasTitleRemaining = !!titleRemaining + const formattedTitleWithBreak = hasTitleRemaining ? `${titlePreview}
${titleRemaining}` : titlePreview + + const returnTitle = titleLength <= maxSize || !hasTitleRemaining ? string : formattedTitleWithBreak + return returnTitle + }) + eleventyConfig.addFilter('renderMarkdown', (text) => { return markdownIt.render(text) }) diff --git a/src/_includes/components/snippets/prototype.njk b/src/_includes/components/snippets/prototype.njk index cc8e1b6..2e8615f 100644 --- a/src/_includes/components/snippets/prototype.njk +++ b/src/_includes/components/snippets/prototype.njk @@ -4,7 +4,7 @@
{% include 'components/svg/logo.njk' %} -

{{ post.fileSlug | truncate(12) }}.dev

+

dev#{{ post.fileSlug | serializeTitle }}

@@ -30,7 +30,7 @@ Link to heading "{{ post.data.title }}" -

{{ post.data.title }}

+

{{ post.data.title | breakLine | safe}}

{{ post.data.description }} diff --git a/src/assets/scss/modules/component/_aboutme.scss b/src/assets/scss/modules/component/_aboutme.scss index 43f40a4..518f969 100644 --- a/src/assets/scss/modules/component/_aboutme.scss +++ b/src/assets/scss/modules/component/_aboutme.scss @@ -227,59 +227,61 @@ .note { rotate: -3deg; - display: flex; - flex: 0 0 auto; - position: relative; - flex-direction: column; - background-color: hsl(0, 0%, 13%); - border-radius: 0.6rem; - box-shadow: 0 0.3125rem 0.625rem hsla(0, 0%, 0%, 0.4); - height: 100%; - transition: all 300ms ease-in-out; + } +} + +.note { + display: flex; + flex: 0 0 auto; + position: relative; + flex-direction: column; + background-color: hsl(0, 0%, 13%); + border-radius: 0.6rem; + box-shadow: 0 0.3125rem 0.625rem hsla(0, 0%, 0%, 0.4); + height: 100%; + transition: all 300ms ease-in-out; + + & > svg { + position: absolute; + right: 0.1rem; + bottom: 0.1rem; + color: hsl(0, 0%, 11%); + } - &>svg { - position: absolute; - right: 0.1rem; - bottom: 0.1rem; - color: hsl(0, 0%, 11%); - z-index: -1; - } + &-heading { + font-weight: 600; + display: block; + text-transform: uppercase; + letter-spacing: 0.1em; + } - &-heading { - font-weight: 600; - display: block; - text-transform: uppercase; - letter-spacing: 0.1em; - } + &-header { + display: flex; + height: 2.5rem; + padding: 0 1rem; + width: 100%; + justify-content: space-between; + box-shadow: 0 0.3125rem 0.625rem hsla(0, 0%, 0%, 0.4); + flex: 0 0 auto; - &-header { + div { display: flex; - height: 2.5rem; - padding: 0 1rem; - width: 100%; - justify-content: space-between; - box-shadow: 0 0.3125rem 0.625rem hsla(0, 0%, 0%, 0.4); - flex: 0 0 auto; + align-items: center; + font-weight: 600; + gap: 0.2rem; - div { - display: flex; - align-items: center; - font-weight: 600; - gap: 0.2rem; + .dot { + height: 0.9375rem; + width: 0.9375rem; + background-color: hsl(0, 100%, 43%); + border-radius: 50%; - .dot { - height: 0.9375rem; - width: 0.9375rem; - background-color: hsl(0, 100%, 43%); - border-radius: 50%; - - &:first-of-type { - background-color: green; - } + &:first-of-type { + background-color: green; + } - &:nth-of-type(2) { - background-color: yellow; - } + &:nth-of-type(2) { + background-color: yellow; } } } diff --git a/src/assets/scss/modules/component/_prototype.scss b/src/assets/scss/modules/component/_prototype.scss index e82b13f..bc4496c 100644 --- a/src/assets/scss/modules/component/_prototype.scss +++ b/src/assets/scss/modules/component/_prototype.scss @@ -136,6 +136,7 @@ gap: 0.5em; font-weight: 700; align-items: center; + line-height: 1.2; } } @@ -208,24 +209,6 @@ } .note { - display: flex; - position: relative; - flex-direction: column; - background-color: hsl(0, 0%, 13%); - border-radius: 0.6rem; - box-shadow: 0 0.3125rem 0.625rem hsla(0, 0%, 0%, 0.4); - height: 100%; - transition: all 300ms ease-in-out; - z-index: 0; - - & > svg { - position: absolute; - right: 0.1rem; - bottom: 0.1rem; - color: hsl(0, 0%, 11%); - z-index: -1; - } - article { padding: 1rem; height: 100%; @@ -238,35 +221,10 @@ } } - &-header { - display: flex; - height: 2.5rem; - padding: 0 1rem; - width: 100%; - justify-content: space-between; - box-shadow: 0 0.3125rem 0.625rem hsla(0, 0%, 0%, 0.4); - flex: 0 0 auto; - - div { - display: flex; - align-items: center; - font-weight: 600; - gap: 0.2rem; - - .dot { - height: 0.9375rem; - width: 0.9375rem; - background-color: hsl(0, 100%, 43%); - border-radius: 50%; - - &:first-of-type { - background-color: green; - } - - &:nth-of-type(2) { - background-color: yellow; - } - } + pre { + overflow: scroll; + &::-webkit-scrollbar { + width: 0; } } } diff --git a/src/blog.njk b/src/blog.njk index 3520ebd..9951f27 100644 --- a/src/blog.njk +++ b/src/blog.njk @@ -3,37 +3,36 @@ title : 'Recent Articles - Blog | EmptyWork' description : "List of all articles that was written by me, its mostly contain topics about Accessibility, PHP, HTML, CSS and Fullstack development" layout: 'layouts/secondary.njk' --- + {% set posts = [] %} +{% set recentPosts = [] %} {% for post in collections.post | reverse %} -{% if post.data.draft == false %} -{% set postDate = { - year: post.data.date | postYear, - fullDate: post.data.date - } %} - {% set posts = (posts.push({ - title: post.data.title, - url: post.url, - date: postDate, - desc: post.data.description, - author: post.data.author, - slug: post.fileSlug - }), posts) %} -{% endif %} -{% endfor %}{% set recentPosts = [] %} -{% for post in collections.post | reverse %} -{% if post.data.draft == false %} - {% set recentPosts = (recentPosts.push({ - title: post.data.title, - description: post.data.description, - url: post.url, - slug: post.fileSlug, - author: post.data.author, - date: post.data.date, - image: post.data.image - }), recentPosts) %} -{% endif %} -{% endfor %}{% set lengthRecentPosts = recentPosts | length %} -{% if lengthRecentPosts > 3 %}{% set recentPosts = recentPosts | sliceRecent %} + {% if not post.data.draft %} + {% set postDate = { + year: post.data.date | postYear, + fullDate: post.data.date + } %} + {% set _ = posts.push({ + title: post.data.title, + url: post.url, + date: postDate, + desc: post.data.description, + author: post.data.author, + slug: post.fileSlug + }) %} + {% set _ = recentPosts.push({ + title: post.data.title, + description: post.data.description, + url: post.url, + slug: post.fileSlug, + author: post.data.author, + date: post.data.date, + image: post.data.image + }) %} + {% endif %} +{% endfor %} +{% if recentPosts | length > 3 %} + {% set recentPosts = recentPosts | sliceRecent %} {% endif %}

@@ -48,38 +47,51 @@ layout: 'layouts/secondary.njk' Link to heading "recent articles" - Recent Articles + Recent Articles {% set groupedPosts = posts | groupby("date.year") %} {% for year, posts in groupedPosts | reverseGroupedPosts %}
-

{{ year }}

+

{{ year }}

    {% for post in posts %} -
  • +
  • -

    -

    - {{ post.desc | truncate(60) }} -

    +

    {{ post.desc | truncate(60) }}

  • {% endfor %}
@@ -101,4 +111,13 @@ layout: 'layouts/secondary.njk' {% endfor %}
-
\ No newline at end of file + + diff --git a/src/contact.njk b/src/contact.njk index 9d0602c..f4f6a6c 100644 --- a/src/contact.njk +++ b/src/contact.njk @@ -21,7 +21,7 @@ layout: 'layouts/secondary.njk'

{{ contact.summary | renderMarkdownInline | safe }}

-