diff --git a/CHANGELOG.md b/CHANGELOG.md index 60fe0e5..786b776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,44 @@ -## Unreleased version +## v6.0.1 (2023-06-08) -- Slightly reworked margins and position for avatar image to resolve an alignment issue on Safari. -- Changed the width at which the navbar collapses to a higher threshold because most modern non-mobile browsers are >1000px -- Fixed bug where navbar secondary level dropdown items didn't inherit te same colour as the primary navbar links +This version has been in the works for a few years. It includes several new features that were highly requested, numerous bug fixes, new documentation, and aggresively encourages migrating from the old Google Universal Analytics to the new Analytics 4. + +#### Breaking changes + +- As of July 2023, Google Universal Analytics is going away and being replaced by Google Analytics 4. Beautiful Jekyll sites that still use the old analytics tag will show a warning to encourage them to move to Analytics 4 (#1096). +- More control over RSS feed sharing: previously, an RSS feed was *always* generated, and if the config setting `rss-description` was set then there was an RSS icon in the footer. Now, an RSS feed is only generated when the config setting `rss-description` exists, and an RSS footer icon is only shown if `rss: true` is set in the `social-network-links` config settings. + +#### New parameters and settings + +- Added `navbar-var-length` config setting that allows the navigation menu to be the same length as the longest sub-menu, so that long words in the submenu are not cut off (#765) +- Added `post_search` config setting that creates a Search button in the navbar (#770) +- Added `edit_page_button` config setting that adds a "Edit page" button to the footer (to edit the current page on GitHub) (#1004) +- Added `footer-hover-col` config setting to customize the hover colour of links in the footer (#848) + +#### New features and improvements + +- Made the home page feed more accessible for screen readers (#950) +- Added support for giscus comments (#886) and CommentBox (#960) +- Added support for Cloudflare Analytics (#797) +- Added Reddit in share options of posts (#815) + +#### Bug fixes + +- Fixed page titles, subtitles, and excerpts rendering correctly when there are special characeters in them (#856) +- Fixed bug where navbar secondary level dropdown items didn't inherit the same colour as the primary navbar links - Fixed bug where the navbar "burger" collapsed button didn't always revert back to a light colour - Fixed bug where using an image as a navbar title did not render in GitHub Project pages that did not have a custom domain -- Fixed issue where image thumbnails on the feed page were always forced into a square rather than maintaining a proper image aspect ratio -- Added support for Patreon in the social network links in the footer +- Fixed bug where image thumbnails on the feed page were always forced into a square rather than maintaining a proper image aspect ratio - Fixed bug where special characters in the title led to broken share tags (#744) +- Fixed bug where staticman didn't work jQuery slim version is used (#766) +- Fixed very long strings to wrap around the next line rather than go off-screen (#787) + +#### Small changes + +- Updated staticman from using v2 (public servers) to v3 (private servers) due to the public servers becoming obsolete (#775) +- Added social network links for Patreon, Medium, Itch.io, Discord, Kaggle, Hackerrank (#783, #788, #907, #961, #978) +- Slightly reworked margins and position for avatar image to resolve an alignment issue on Safari +- Changed the width at which the navbar collapses to a higher threshold because most modern non-mobile browsers are >1000px + ## v5.0.0 (2020-09-15) @@ -54,7 +85,6 @@ One of the major changes in this version is that a lot of time was spent on reth - Upgraded kramdown to version 2.3.0 to fix security issues - Upgraded jQuery to version 3.5.1 to fix a couple security vulnerabilities with the previous version - ## v4.1.0 (2020-08-08) - Added Open Graph `site_name` meta field to pages automatically diff --git a/LICENSE b/LICENSE index 27e2cdf..0b6ae57 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Dean Attali +Copyright (c) 2023 Dean Attali Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/_config.yml b/_config.yml index 5ef1b82..98460c5 100644 --- a/_config.yml +++ b/_config.yml @@ -1,9 +1,13 @@ -# Welcome to Beautiful Jekyll! -# This config file is meant for settings that affect your entire website. When you first -# set up your website you should go through all these settings and edit them, but after -# the initial set up you won't need to come back to this file often. +########################################################### +### Welcome to Beautiful Jekyll! +### This config file is meant for settings that affect your entire website. When you first +### set up your website you should go through all these settings and edit them, but after +### the initial set up you won't need to come back to this file often. +########################################################### +############################ # --- Required options --- # +############################ # Name of website title: YameteTomete Translation Cooperative @@ -11,7 +15,9 @@ title: YameteTomete Translation Cooperative # Your name to show in the footer author: YameteTomete +############################################### # --- List of links in the navigation bar --- # +############################################### url: https://yamatotoma.to @@ -23,7 +29,9 @@ navbar-links: - Good Job! Media: "https://www.goodjobmedia.com/" Discord: "https://discord.gg/fpQZQ8g" +################ # --- Logo --- # +################ # Image to show in the navigation bar - works best with a square image # Remove this parameter if you don't want an image in the navbar @@ -37,7 +45,9 @@ round-avatar: true #title-img: /path/to/image +##################################### # --- Footer social media links --- # +##################################### # Select the social network links that you want to show in the footer. # Uncomment the links you want to show and add your information to each one. @@ -48,6 +58,9 @@ social-network-links: twitter: YameteTomete # patreon: DeanAttali # youtube: c/daattali +# email: "someone@example.com" +# rss: true # remove this line if you don't want to show an RSS link at the bottom +# medium: yourname # reddit: yourname # linkedin: daattali # xing: yourname @@ -65,12 +78,17 @@ social-network-links: bluesky: yametetomete.bsky.social # ORCID: your ORCID ID # google-scholar: your google scholar +# discord: "invite_code" or "users/userid" or "invite/invite_code" +# kaggle: yourname +# hackerrank: yourname -# If you want to show a link to an RSS in the footer, add the site description here. -# If you don't want to show an RSS link, remove the following line. +# If you want your website to generate an RSS feed, provide a description +# The URL for the feed will be https:///feed.xml # rss-description: This website is a virtual proof that I'm awesome +########################### # --- General options --- # +########################### # Select which social network share links to show in posts share-links-active: @@ -95,10 +113,23 @@ excerpt_separator: # Whether or not to show a list of tags below each post preview in the feed page feed_show_tags: false +# Add a search button to the navbar +post_search: true + +# Add a button in the footer to edit the current page. Only works if your website is hosted on GitHub +edit_page_button: true + +# Allow sub-menu items (second-level navigation menu items) to be longer than the top-level menu +# If this setting is off, then long sub-menu words might get cut off +# See https://github.com/daattali/beautiful-jekyll/issues/765 to understand the issue this setting can solve +navbar-var-length: false + # The keywords to associate with your website, for SEO purposes #keywords: "my,list,of,keywords" +###################################### # --- Colours / background image --- # +###################################### # Personalize the colours in your website. Colour values can be any valid CSS colour @@ -112,6 +143,7 @@ hover-col: "#0085A1" footer-col: "#EAEAEA" footer-text-col: "#777777" footer-link-col: "#404040" +footer-hover-col: "#0085A1" # Alternatively, the navbar, footer, and page background can be set to an image # instead of colour @@ -131,13 +163,15 @@ footer-link-col: "#404040" #site-js: # - "/assets/js/custom-script.js" +################################# # --- Web Analytics Section --- # +################################# -# Fill in your Google Analytics gtag.js ID to track your website using gtag -#gtag: "" +# Fill in your Google Analytics tag ID (or "Measurement ID") to track your website usage +#gtag: "G-XXXXXXXXXX" -# Fill in your Google Analytics ID to track your website using Google Analytics -#google_analytics: "" +# Fill in your Cloudflare Analytics beacon token to track your website using Cloudflare Analytics +#cloudflare_analytics: "" # Google Tag Manager ID #gtm: "" @@ -150,7 +184,14 @@ footer-link-col: "#404040" # uri: "demo.wiki.pro" # opt-out: true +# Google Universal Analytics ID -- deprecated +# As of July 2023 this is no longer supported by Google! If you are still using `google_analytics`, +# you should switch to using the `gtag` field above instead. +#google_analytics: "UA-XXXXXXXX-X" + +#################### # --- Comments --- # +#################### # To use Disqus comments, sign up to https://disqus.com and fill in your Disqus shortname (NOT the userid) #disqus: "" @@ -158,6 +199,9 @@ footer-link-col: "#404040" # To use Facebook Comments, create a Facebook app and fill in the Facebook App ID #fb_comment_id: "" +# To use CommentBox, sign up for a Project ID on https://commentbox.io +#commentbox: "" # Project ID, e.g. "5694267682979840-proj" + # To use Utterances comments: (0) uncomment the following section, (1) fill in # "repository" (make sure the repository is public), (2) Enable Issues in your repository, # (3) Install the Utterances app in your repository https://github.com/apps/utterances @@ -168,21 +212,39 @@ footer-link-col: "#404040" # theme: github-light # Utterances theme # label: blog-comments # Label that will be assigned to GitHub Issues created by Utterances -# To use Staticman comments, first invite `staticmanlab` as a collaborator to your repository and -# accept the invitation by going to `https://staticman3.herokuapp.com/v3/connect/github//`. -# Then uncomment the following section and fill in "repository" and "branch". -# If you want to use reCaptcha for staticman (optional for spam protection), then fill -# in the "siteKey" and "secret" parameters below and also in `staticman.yml`. -# See more details at https://staticman.net/ +# To use Staticman comments, uncomment the following section. You may leave the reCaptcha +# section commented if you aren't using reCaptcha for spam protection. +# Using Staticman requires advanced knowledge, please consult +# https://github.com/eduardoboucas/staticman/ and https://staticman.net/ for further +# instructions. For any support with staticman please direct questions to staticman and +# not to BeautifulJekyll. #staticman: # repository : # GitHub username/repository eg. "daattali/beautiful-jekyll" # branch : master # If you're not using `master` branch, then you also need to update the `branch` parameter in `staticman.yml` -# endpoint : # (optional) URL of your own deployment, with a trailing slash eg. https:///v3/entry/github/ (will fallback to a public GitLab instance) -# reCaptcha: -# siteKey : # Use your own site key, you need to apply for one on Google -# secret : # ENCRYPT your password by going to https://staticman3.herokuapp.com/v3/encrypt/ +# endpoint : # URL of your deployment, with a trailing slash eg. "https:///v3/entry/github/" +# reCaptcha: # (optional, set these parameters in `staticman.yml` as well) +# siteKey : # You need to apply for a site key on Google +# secret : # Encrypt your password by going to https:///v3/encrypt/ +# To use giscus comments: +# (0) Uncomment the following giscus section, (1) Enable Discussions in your GitHub repository, +# (2) Install the giscus app in your repository (details at https://giscus.app), +# (3) Fill in *all* the parameters below +# See more details about giscus and each of the following parameters at https://giscus.app +#giscus: +# hostname: giscus.app # Replace with your giscus instance's hostname if self-hosting +# repository: # GitHub username/repository eg. "daattali/beautiful-jekyll" +# repository-id: # ID of your repository, retrieve this info from https://giscus.app +# category: Announcements # Category name of your GitHub Discussion posts +# category-id: # ID of your category, retrieve this info from https://giscus.app +# mapping: pathname +# reactions-enabled: 1 +# emit-metadata: 0 +# theme: light + +################ # --- Misc --- # +################ # Ruby Date Format to show dates of posts date_format: "%B %-d, %Y" @@ -190,7 +252,9 @@ date_format: "%B %-d, %Y" # Facebook App ID #fb_app_id: "" +################################################################################# # --- You don't need to touch anything below here (but you can if you want) --- # +################################################################################# # Output options (more information on Jekyll's site) timezone: "Etc/UTC" diff --git a/_includes/cloudflare_analytics.html b/_includes/cloudflare_analytics.html new file mode 100644 index 0000000..bd63f8b --- /dev/null +++ b/_includes/cloudflare_analytics.html @@ -0,0 +1,8 @@ +{% if site.cloudflare_analytics %} + + + +{% endif %} diff --git a/_includes/commentbox.html b/_includes/commentbox.html new file mode 100644 index 0000000..e8019da --- /dev/null +++ b/_includes/commentbox.html @@ -0,0 +1,7 @@ +{% if site.commentbox %} + +
+ + + +{% endif %} diff --git a/_includes/comments.html b/_includes/comments.html index ce34285..6624233 100644 --- a/_includes/comments.html +++ b/_includes/comments.html @@ -3,4 +3,6 @@ {% include fb-comment.html %} {% include staticman-comments.html %} {% include utterances-comment.html %} + {% include giscus-comment.html %} + {% include commentbox.html %} {% endif %} diff --git a/_includes/footer.html b/_includes/footer.html index 8fb0e7e..66d8555 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -30,6 +30,12 @@ Do-not-Track {% endif %} {% endif%} + + {% if site.edit_page_button and site.github.repository_url %} +  •  + Edit page + {% endif%} +

{% unless site.remove-ads %}

Powered by diff --git a/_includes/giscus-comment.html b/_includes/giscus-comment.html new file mode 100644 index 0000000..b6e7fa1 --- /dev/null +++ b/_includes/giscus-comment.html @@ -0,0 +1,16 @@ +{% if site.giscus.repository and site.giscus.hostname %} + + + +{% endif %} diff --git a/_includes/google_analytics.html b/_includes/google_analytics.html index 01f7406..d9b053f 100644 --- a/_includes/google_analytics.html +++ b/_includes/google_analytics.html @@ -1,5 +1,17 @@ {% if site.google_analytics %} +{% unless site.gtag %} +

+
×
+
+ This website is using outdated Google Analytics +
+ More info + As of July 2023, Google's Universal Analytics is going away and being replaced by Google Analytics 4. This website is still using the old Universal Analytics. In order to remove this message, the website owner must remove the google_analytics property in the website's config file, and optionally replace it with the new gtag property. +
+
+
+{% endunless %} + + + +{% endif %} diff --git a/_includes/social-networks-links.html b/_includes/social-networks-links.html index bf29b0a..4745691 100644 --- a/_includes/social-networks-links.html +++ b/_includes/social-networks-links.html @@ -1,6 +1,6 @@ diff --git a/_includes/social-share.html b/_includes/social-share.html index 2091c88..4a7ca01 100644 --- a/_includes/social-share.html +++ b/_includes/social-share.html @@ -11,7 +11,7 @@ Share: {% if site.share-links-active.twitter %} - Twitter @@ -42,6 +42,14 @@ {% endif %} + {% if site.share-links-active.reddit %} + + + Reddit + + {% endif %} + {% endif %} diff --git a/_layouts/base.html b/_layouts/base.html index 0fed7af..c0d8667 100644 --- a/_layouts/base.html +++ b/_layouts/base.html @@ -21,7 +21,7 @@ common-js: - + {% include head.html %} diff --git a/_layouts/home.html b/_layouts/home.html index c97b27f..cab91a5 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -6,88 +6,96 @@ layout: page {% assign posts = paginator.posts | default: site.posts %} -
+ +
    {% for post in posts %} -
    +
  • +
    - {%- capture thumbnail -%} - {% if post.thumbnail-img %} - {{ post.thumbnail-img }} - {% elsif post.cover-img %} - {% if post.cover-img.first %} - {{ post.cover-img[0].first.first }} + {%- capture thumbnail -%} + {% if post.thumbnail-img %} + {{ post.thumbnail-img }} + {% elsif post.cover-img %} + {% if post.cover-img.first %} + {{ post.cover-img[0].first.first }} + {% else %} + {{ post.cover-img }} + {% endif %} {% else %} - {{ post.cover-img }} {% endif %} - {% else %} + {% endcapture %} + {% assign thumbnail=thumbnail | strip %} + + {% if site.feed_show_excerpt == false %} + {% if thumbnail != "" %} +
    + + Post thumbnail + +
    {% endif %} - {% endcapture %} - {% assign thumbnail=thumbnail | strip %} - - {% if site.feed_show_excerpt == false %} - {% if thumbnail != "" %} -
    - - Post thumbnail - -
    - {% endif %} - {% endif %} - - -

    {{ post.title }}

    - - {% if post.subtitle %} -

    - {{ post.subtitle }} -

    {% endif %} -
    - + +

    {{ post.title | strip_html }}

    - {% if thumbnail != "" %} -
    - - Post thumbnail + {% if post.subtitle %} +

    + {{ post.subtitle | strip_html }} +

    + {% endif %}
    -
    - {% endif %} - {% unless site.feed_show_excerpt == false %} - {% if thumbnail != "" %} -
    - - Post thumbnail - -
    - {% endif %} + -
    - {% assign excerpt_length = site.excerpt_length | default: 50 %} - {{ post.excerpt | strip_html | xml_escape | truncatewords: excerpt_length }} - {% assign excerpt_word_count = post.excerpt | number_of_words %} - {% if post.content != post.excerpt or excerpt_word_count > excerpt_length %} - [Read More] + {% if thumbnail != "" %} +
    + + Post thumbnail + +
    {% endif %} -
    - {% endunless %} - {% if site.feed_show_tags != false and post.tags.size > 0 %} -
    - Tags: - {% for tag in post.tags %} - {{- tag -}} - {% endfor %} -
    - {% endif %} + {% unless site.feed_show_excerpt == false %} + {% if thumbnail != "" %} +
    + + Post thumbnail + +
    + {% endif %} -
    +
    + {% assign excerpt_length = site.excerpt_length | default: 50 %} + {{ post.excerpt | strip_html | truncatewords: excerpt_length }} + {% assign excerpt_word_count = post.excerpt | number_of_words %} + {% if post.content != post.excerpt or excerpt_word_count > excerpt_length %} + [Read More] + {% endif %} +
    + {% endunless %} + + {% if site.feed_show_tags != false and post.tags.size > 0 %} +
    + Tags: + +
      + {% for tag in post.tags %} +
    • + {{- tag -}} +
    • + {% endfor %} +
    +
    + {% endif %} + +
  • + {% endfor %} -
+ {% if paginator.total_pages > 1 %}
    diff --git a/_layouts/post.html b/_layouts/post.html index 5358515..70d5ee4 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -67,12 +67,12 @@ layout: base diff --git a/assets/css/beautifuljekyll.css b/assets/css/beautifuljekyll.css index d8d8b4a..316702a 100644 --- a/assets/css/beautifuljekyll.css +++ b/assets/css/beautifuljekyll.css @@ -20,6 +20,7 @@ body { background-image: url({{ site.page-img | relative_url }}); background-attachment: fixed; {% endif %} + overflow-wrap: break-word; } p { line-height: 1.5; @@ -246,22 +247,28 @@ img { } .navbar-custom .nav-item.dropdown .dropdown-menu { - min-width: 0; margin-top: 0; font-size: 1em; border: 0; padding: 0; + {% if site.navbar-var-length %} + min-width: 100%; + {% else %} + min-width: 0; width: 100%; word-break: break-word; + {% endif %} } + .navbar-custom .nav-item.dropdown .dropdown-menu .dropdown-item { - white-space: normal; padding: 0.625rem; background-color: {{ site.navbar-col | default: "#EAEAEA" }}; text-decoration: none !important; - border-width: 0 1px 1px 1px; font-weight: normal; color: {{ site.navbar-text-col | default: "#404040" }}; + {% unless site.navbar-var-length %} + white-space: normal; + {% endunless %} } @media (min-width: 1200px) { @@ -274,6 +281,10 @@ img { border: 1px solid {{ site.navbar-border-col | default: "#DDDDDD" }}; border-width: 0 1px 1px; } + + .navbar-custom .nav-item.dropdown .dropdown-menu .dropdown-item:first-child { + border-top-width: 1px; + } } @media (max-width: 1199px) { @@ -388,6 +399,11 @@ footer a { color: {{ site.footer-link-col | default: "#404040" }}; } +footer a:hover, +footer a:focus { + color: {{ site.footer-hover-col | default: "#0085A1" }}; +} + footer .list-inline { margin: 0; padding: 0; @@ -426,6 +442,10 @@ footer .footer-custom-content { /* --- Post preview (feed) --- */ +.posts-list { + margin: 0; +} + .post-preview { padding: 1.25rem 0; border-bottom: 1px solid #eee; @@ -556,6 +576,10 @@ footer .footer-custom-content { opacity: 0.8; } +.blog-tags .list-inline-item { + margin-right: 0; +} + .blog-tags a { color: {{ site.text-col | default: "#404040" }}; text-decoration: none; @@ -993,3 +1017,104 @@ pre { display: block; margin: 0 auto; } + +/* Search bar */ +#beautifuljekyll-search-overlay { + display: none; + z-index: 999999; + position: fixed; + background: rgba(0,0,0,0.9); + left: 0; + right: 0; + top: 0; + bottom: 0; + text-align: center; + padding: 1rem; +} +#nav-search-exit { + position: absolute; + top: 1.5rem; + cursor: pointer; + right: 25%; + margin-right: 2rem; + color: #555; + font-size: 2rem; + line-height: 2rem; + font-weight: bold; +} +#nav-search-exit:hover { + color: #000; +} +#nav-search-input { + text-align: center; + background: #e7edee; + margin: auto; + display: block; + font-size: 2rem; + width: 50%; + transition: width 300ms ease; + color: #222; + border-radius: 5rem; + outline: none; + border: none; + padding: 0 3rem; +} +@media (max-width: 1199px) { + #nav-search-input { + width: 75%; + } + #nav-search-exit { + right: 12.5%; + } +} +@media (max-width: 767px) { + #nav-search-input { + width: 100%; + } + #nav-search-exit { + right: 0; + } +} +#nav-search-input:focus { + background: #f3f8fe; + box-shadow: 0px 0.15rem 1rem #e7f4ff; + outline: none; +} + +#nav-search-input::placeholder { + color: #777; +} + +#search-results-container { + list-style: none; + padding-left: unset; + margin-top: 1.5rem; + color: #fff; + font-size: 1.5rem; + max-height: calc(100vh - 6.5rem); + overflow-y: auto; +} +#search-results-container a { + color: #fff; + text-decoration: none; +} +#search-results-container a:hover { + color: #fff; + text-decoration: underline; +} + +#nav-search-icon { + display: inline-block; +} +#nav-search-text { + display: none; +} + +@media (max-width: 1199px) { + #nav-search-icon { + display: none; + } + #nav-search-text { + display: inline-block; + } +} diff --git a/assets/js/beautifuljekyll.js b/assets/js/beautifuljekyll.js index bcddc67..c871dd7 100644 --- a/assets/js/beautifuljekyll.js +++ b/assets/js/beautifuljekyll.js @@ -1,6 +1,6 @@ -// Dean Attali / Beautiful Jekyll 2020 +// Dean Attali / Beautiful Jekyll 2023 -var BeautifulJekyllJS = { +let BeautifulJekyllJS = { bigImgEl : null, numImgs : null, @@ -27,6 +27,8 @@ var BeautifulJekyllJS = { // show the big header image BeautifulJekyllJS.initImgs(); + + BeautifulJekyllJS.initSearch(); }, initNavbar : function() { @@ -52,23 +54,23 @@ var BeautifulJekyllJS = { // 2fc73a3a967e97599c9763d05e564189 // set an initial image - var imgInfo = BeautifulJekyllJS.getImgInfo(); - var src = imgInfo.src; - var desc = imgInfo.desc; + const imgInfo = BeautifulJekyllJS.getImgInfo(); + const src = imgInfo.src; + const desc = imgInfo.desc; BeautifulJekyllJS.setImg(src, desc); // For better UX, prefetch the next image so that it will already be loaded when we want to show it - var getNextImg = function() { - var imgInfo = BeautifulJekyllJS.getImgInfo(); - var src = imgInfo.src; - var desc = imgInfo.desc; + const getNextImg = function() { + const imgInfo = BeautifulJekyllJS.getImgInfo(); + const src = imgInfo.src; + const desc = imgInfo.desc; - var prefetchImg = new Image(); + const prefetchImg = new Image(); prefetchImg.src = src; // if I want to do something once the image is ready: `prefetchImg.onload = function(){}` setTimeout(function(){ - var img = $("
    ").addClass("big-img-transition").css("background-image", 'url(' + src + ')'); + const img = $("
    ").addClass("big-img-transition").css("background-image", 'url(' + src + ')'); $(".intro-header.big-img").prepend(img); setTimeout(function(){ img.css("opacity", "1"); }, 50); @@ -91,9 +93,9 @@ var BeautifulJekyllJS = { }, getImgInfo : function() { - var randNum = Math.floor((Math.random() * BeautifulJekyllJS.numImgs) + 1); - var src = BeautifulJekyllJS.bigImgEl.attr("data-img-src-" + randNum); - var desc = BeautifulJekyllJS.bigImgEl.attr("data-img-desc-" + randNum); + const randNum = Math.floor((Math.random() * BeautifulJekyllJS.numImgs) + 1); + const src = BeautifulJekyllJS.bigImgEl.attr("data-img-src-" + randNum); + const desc = BeautifulJekyllJS.bigImgEl.attr("data-img-desc-" + randNum); return { src : src, @@ -108,6 +110,30 @@ var BeautifulJekyllJS = { } else { $(".img-desc").hide(); } + }, + + initSearch : function() { + if (!document.getElementById("beautifuljekyll-search-overlay")) { + return; + } + + $("#nav-search-link").click(function(e) { + e.preventDefault(); + $("#beautifuljekyll-search-overlay").show(); + $("#nav-search-input").focus().select(); + $("body").addClass("overflow-hidden"); + }); + $("#nav-search-exit").click(function(e) { + e.preventDefault(); + $("#beautifuljekyll-search-overlay").hide(); + $("body").removeClass("overflow-hidden"); + }); + $(document).on('keyup', function(e) { + if (e.key == "Escape") { + $("#beautifuljekyll-search-overlay").hide(); + $("body").removeClass("overflow-hidden"); + } + }); } }; diff --git a/assets/js/staticman.js b/assets/js/staticman.js index 09422a6..9ecf188 100644 --- a/assets/js/staticman.js +++ b/assets/js/staticman.js @@ -3,40 +3,51 @@ layout: null --- (function ($) { - var $comments = $('.js-comments'); - $('#new_comment').submit(function () { - var form = this; + const form = this; $(form).addClass('disabled'); {% assign sm = site.staticman -%} - var endpoint = '{{ sm.endpoint | default: "https://staticman3.herokuapp.com/v3/entry/github/" }}'; - var repository = '{{ sm.repository }}'; - var branch = '{{ sm.branch }}'; + const endpoint = '{{ sm.endpoint }}'; + const repository = '{{ sm.repository }}'; + const branch = '{{ sm.branch }}'; + const url = endpoint + repository + '/' + branch + '/comments'; + const data = $(this).serialize(); - $.ajax({ - type: $(this).attr('method'), - url: endpoint + repository + '/' + branch + '/comments', - data: $(this).serialize(), - contentType: 'application/x-www-form-urlencoded', - success: function (data) { - $('#comment-form-submit').addClass('d-none'); - $('#comment-form-submitted').removeClass('d-none'); - $('.page__comments-form .js-notice').removeClass('alert-danger'); - $('.page__comments-form .js-notice').addClass('alert-success'); - showAlert('success'); - }, - error: function (err) { - console.log(err); - $('#comment-form-submitted').addClass('d-none'); - $('#comment-form-submit').removeClass('d-none'); - $('.page__comments-form .js-notice').removeClass('alert-success'); - $('.page__comments-form .js-notice').addClass('alert-danger'); - showAlert('failure'); - $(form).removeClass('disabled'); + const xhr = new XMLHttpRequest(); + xhr.open("POST", url); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhr.onreadystatechange = function () { + if(xhr.readyState === XMLHttpRequest.DONE) { + const status = xhr.status; + if (status >= 200 && status < 400) { + formSubmitted(); + } else { + formError(); + } } - }); + }; + + function formSubmitted() { + $('#comment-form-submit').addClass('d-none'); + $('#comment-form-submitted').removeClass('d-none'); + $('.page__comments-form .js-notice').removeClass('alert-danger'); + $('.page__comments-form .js-notice').addClass('alert-success'); + showAlert('success'); + } + + function formError() { + $('#comment-form-submitted').addClass('d-none'); + $('#comment-form-submit').removeClass('d-none'); + $('.page__comments-form .js-notice').removeClass('alert-success'); + $('.page__comments-form .js-notice').addClass('alert-danger'); + showAlert('failure'); + $(form).removeClass('disabled'); + } + + xhr.send(data); return false; }); diff --git a/beautiful-jekyll-theme.gemspec b/beautiful-jekyll-theme.gemspec index 8ffd662..d11e701 100644 --- a/beautiful-jekyll-theme.gemspec +++ b/beautiful-jekyll-theme.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "beautiful-jekyll-theme" - spec.version = "5.0.0" + spec.version = "6.0.1" spec.authors = ["Dean Attali"] spec.email = ["daattali@gmail.com"] @@ -17,11 +17,12 @@ Gem::Specification.new do |spec| "documentation_uri" => "https://github.com/daattali/beautiful-jekyll#readme" } - spec.add_runtime_dependency "jekyll", "~> 3.8" + spec.add_runtime_dependency "jekyll", ">= 3.9.3" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4" spec.add_runtime_dependency "kramdown-parser-gfm", "~> 1.1" - spec.add_runtime_dependency "kramdown", "~> 2.3.0" + spec.add_runtime_dependency "kramdown", "~> 2.3.2" + spec.add_runtime_dependency "webrick", "~> 1.8" spec.add_development_dependency "bundler", ">= 1.16" spec.add_development_dependency "rake", "~> 12.0" diff --git a/feed.xml b/feed.xml index 57f7ad5..6148cf1 100644 --- a/feed.xml +++ b/feed.xml @@ -15,9 +15,9 @@ layout: null {% assign excerpt_length = site.excerpt_length | default: 50 %} {% for post in site.posts limit:20 %} - {{ post.title | xml_escape }} + {{ post.title | strip_html | xml_escape }} - {% if post.subtitle %}{{ post.subtitle | xml_escape }} - {% endif %} + {% if post.subtitle %}{{ post.subtitle | strip_html | xml_escape }} - {% endif %} {{ post.content | strip_html | xml_escape | truncatewords: excerpt_length }} {{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }} diff --git a/staticman.yml b/staticman.yml index 8fe1bad..45e939b 100644 --- a/staticman.yml +++ b/staticman.yml @@ -5,7 +5,7 @@ # To encrypt strings use the following endpoint: # https://{STATICMAN API INSTANCE}/v3/encrypt/{TEXT TO BE ENCRYPTED} # {STATICMAN API INSTANCE} should match the `endpoint` in the theme config -# file. It defaults to "staticman3.herokuapp.com". +# file. comments: # (*) REQUIRED diff --git a/tags.html b/tags.html index 04c1939..55a3c6d 100644 --- a/tags.html +++ b/tags.html @@ -25,7 +25,7 @@ title: 'Tag Index'
    {%- for post in site.tags[tag] -%}
    - {{- post.title -}} + {{- post.title | strip_html -}}