add last-updated YAML parameter

This commit is contained in:
Dean Attali 2020-09-12 22:30:43 +00:00
parent 9827abc40e
commit d57097a1fe
5 changed files with 60 additions and 45 deletions

View File

@ -17,6 +17,7 @@ One of the major changes in this version is that a lot of time was spent on reth
- Added `feed_show_excerpt` config setting to show/hide the post excerpts on the feed page - Added `feed_show_excerpt` config setting to show/hide the post excerpts on the feed page
- Added `feed_show_tags` config setting to show/hide the list of tags on post previews on the feed page - Added `feed_show_tags` config setting to show/hide the list of tags on post previews on the feed page
- Added `share-title` YAML parameter to give control over the search engine/social media title - Added `share-title` YAML parameter to give control over the search engine/social media title
- Added `last-updated` YAML parameter to show a "Last Updated on" date for blog posts
- Added `before-content` and `after-content` YAML parameters that allow you to add some common HTML before the main content of a page (below the title) or after the main content (above the footer). Works in a similar way to `footer-extra`. - Added `before-content` and `after-content` YAML parameters that allow you to add some common HTML before the main content of a page (below the title) or after the main content (above the footer). Works in a similar way to `footer-extra`.
- Added `head-extra` YAML parameter which is similar to `footer-extra` but is used to include custom HTML code in a page's `<head>` tag - Added `head-extra` YAML parameter which is similar to `footer-extra` but is used to include custom HTML code in a page's `<head>` tag
- Added `site-js` config setting to provide JavaScript files that are used on all pages in the site - Added `site-js` config setting to provide JavaScript files that are used on all pages in the site

View File

@ -163,6 +163,7 @@ social-share | By default, every blog post has buttons to share the page on soci
nav-short | By default, the navigation bar gets shorter after scrolling down the page. If you want the navigation bar to always be short on a certain page, use `nav-short: true` nav-short | By default, the navigation bar gets shorter after scrolling down the page. If you want the navigation bar to always be short on a certain page, use `nav-short: true`
gh-repo | If you want to show GitHub buttons at the top of a post, this sets the GitHub repo name (eg. `daattali/beautiful-jekyll`). You must also use the `gh-badge` parameter to specify what buttons to show. gh-repo | If you want to show GitHub buttons at the top of a post, this sets the GitHub repo name (eg. `daattali/beautiful-jekyll`). You must also use the `gh-badge` parameter to specify what buttons to show.
gh-badge | Select which GitHub buttons to display. Available options are: [star, watch, fork, follow]. You must also use the `gh-repo` parameter to specify the GitHub repo. gh-badge | Select which GitHub buttons to display. Available options are: [star, watch, fork, follow]. You must also use the `gh-repo` parameter to specify the GitHub repo.
last-updated | If you want to show that a blog post was updated after it was originally released, you can specify an "Updated on" date.
layout | What type of page this is (default is `post` for blog posts and `page` for other pages). See _Page types_ section below for more information. layout | What type of page this is (default is `post` for blog posts and `page` for other pages). See _Page types_ section below for more information.
## Advanced parameters ## Advanced parameters
@ -255,7 +256,8 @@ Beautiful Jekyll is used by 50,000+ people with wildly varying degrees of web sk
- ### How do I make small modifications to how my website looks? - ### How do I make small modifications to how my website looks?
If you want to make any visual changes that are not in `_config.yml`, you'll need to add your own CSS rules to the file `assets/css/custom-styles.css` and enable the `site-css` setting in the config file. This will allow you to overwrite the default Beautiful Jekyll styles. If you don't know how to use CSS, I highly recommend spending 30 minutes to [learn the basics](https://www.w3schools.com/css/). If you want to make any visual changes that are not in `_config.yml`, you'll need to add your own CSS rules to the file `assets/css/custom-styles.css` and enable the `
s` setting in the config file. This will allow you to overwrite the default Beautiful Jekyll styles. If you don't know how to use CSS, I highly recommend spending 30 minutes to [learn the basics](https://www.w3schools.com/css/).
- ### How do I use a custom domain for my site? - ### How do I use a custom domain for my site?

View File

@ -39,6 +39,12 @@
{% if include.type == "post" %} {% if include.type == "post" %}
<span class="post-meta">Posted on {{ page.date | date: date_format }}</span> <span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
{% if page.last-updated %}
<span class="post-meta">
<span class="d-none d-md-inline middot">&middot;</span>
Last updated {{ page.last-updated | date: date_format }}
</span>
{% endif %}
{% if page.readtime %} {% if page.readtime %}
{% include readtime.html %} {% include readtime.html %}
{% endif %} {% endif %}
@ -67,6 +73,12 @@
{% if include.type == "post" %} {% if include.type == "post" %}
<span class="post-meta">Posted on {{ page.date | date: date_format }}</span> <span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
{% if page.last-updated %}
<span class="post-meta">
<span class="d-none d-md-inline middot">&middot;</span>
Last updated {{ page.last-updated | date: date_format }}
</span>
{% endif %}
{% if page.readtime %} {% if page.readtime %}
{% include readtime.html %} {% include readtime.html %}
{% endif %} {% endif %}

View File

@ -6,10 +6,10 @@
{% assign number = finalReadTime | round %} {% assign number = finalReadTime | round %}
{% if number >= 1 %} {% if number >= 1 %}
{% assign yesReadTime = number | append: " minute read" %} {% assign yesReadTime = number | append: " minute read" %}
<span class="reader-time post-meta"><span class="d-none d-md-inline middot">&middot;</span> {{ yesReadTime }}</span> <span class="post-meta"><span class="d-none d-md-inline middot">&middot;</span> {{ yesReadTime }}</span>
{% elsif number < 1 %} {% elsif number < 1 %}
{% assign minReadTime = '&lt; 1 minute read' %} {% assign minReadTime = '&lt; 1 minute read' %}
<span class="reader-time post-meta"><span class="d-none d-md-inline middot">&middot;</span> {{ minReadTime }}</span> <span class="post-meta"><span class="d-none d-md-inline middot">&middot;</span> {{ minReadTime }}</span>
{% else %} {% else %}
{% assign nilReadTime = number | replace:'0',' ' %} {% assign nilReadTime = number | replace:'0',' ' %}
{{ nilReadTime }} {{ nilReadTime }}

View File

@ -475,6 +475,18 @@ footer .footer-custom-content {
margin: 0 0 0.625rem; margin: 0 0 0.625rem;
font-family: 'Lora', 'Times New Roman', serif; font-family: 'Lora', 'Times New Roman', serif;
} }
.post-heading .post-meta {
display: inline-block;
}
@media (max-width: 767px) {
.post-heading .post-meta {
display: block;
margin-bottom: 0;
}
}
.post-heading .post-meta .middot {
margin: 0 0.625rem;
}
.post-preview .post-entry { .post-preview .post-entry {
width: 100%; width: 100%;
} }
@ -751,18 +763,6 @@ nav.top-nav-short-permanent ~ header > .intro-header.big-img {
} }
} }
.reader-time {
display: inline-block;
}
@media (max-width: 767px) {
.reader-time {
display: block;
}
}
.reader-time .middot {
margin: 0 0.625rem;
}
/* --- Pagination --- */ /* --- Pagination --- */
.pagination { .pagination {