parent
a9b7ffee6c
commit
d8848b71a0
10 changed files with 173 additions and 93 deletions
@ -1,18 +0,0 @@ |
||||
#+title: Single Post with suppressed lastmod |
||||
#+hugo_base_dir: ../../ |
||||
#+hugo_section: singles |
||||
#+date: [2118-09-01 Sat 05:08] |
||||
#+macro: doc [[https://ox-hugo.scripter.co/doc/$1][$2]] |
||||
#+hugo_auto_set_lastmod: t |
||||
|
||||
This post will not export =lastmod= because |
||||
=org-hugo-suppress-lastmod-period= is greater than the time |
||||
difference between =[2118-09-01 Sat 05:08]= and the current |
||||
date. |
||||
|
||||
* Local Variables :ARCHIVE: |
||||
# Local Variables: |
||||
# org-hugo-auto-set-lastmod: nil |
||||
# org-hugo-suppress-lastmod-period: 0.0 |
||||
# End: |
||||
|
||||
@ -1,16 +0,0 @@ |
||||
#+title: Single Post with unsuppressed lastmod |
||||
#+hugo_base_dir: ../../ |
||||
#+hugo_section: singles |
||||
#+date: [1999-09-01 Sat 05:11] |
||||
#+hugo_auto_set_lastmod: t |
||||
|
||||
This post will export =lastmod= because |
||||
=org-hugo-suppress-lastmod-period= is less than the time difference |
||||
between =[1999-09-01 Sat 05:11]= and the current date. |
||||
|
||||
* Local Variables :ARCHIVE: |
||||
# Local Variables: |
||||
# org-hugo-auto-set-lastmod: nil |
||||
# org-hugo-suppress-lastmod-period: 0.0 |
||||
# End: |
||||
|
||||
@ -0,0 +1,70 @@ |
||||
#+title: Tests for org-hugo-suppress-lastmod-period set to 2 days |
||||
|
||||
#+hugo_base_dir: ../ |
||||
|
||||
#+filetags: suppress lastmod nonzero |
||||
|
||||
#+author: |
||||
|
||||
* Common |
||||
:PROPERTIES: |
||||
:CUSTOM_ID: common |
||||
:END: |
||||
~org-hugo-suppress-lastmod-period~ is set to *172800.0* seconds (2 |
||||
days) in Local Variables. |
||||
|
||||
/For tests, the "current date" is always Dec 21, 2100./ |
||||
* Auto set lastmod :autoset: |
||||
:PROPERTIES: |
||||
:EXPORT_HUGO_AUTO_SET_LASTMOD: t |
||||
:END: |
||||
** Suppress lastmod with auto-set-lastmod |
||||
:PROPERTIES: |
||||
:EXPORT_DATE: 2100-12-21 |
||||
:EXPORT_FILE_NAME: suppress-lastmod-in-subtree-with-auto-lastmod |
||||
:END: |
||||
#+begin_description |
||||
~lastmod~ front-matter parameter is suppressed in this post. |
||||
#+end_description |
||||
|
||||
#+include: "./suppress-lastmod-period-non-zero.org::#common" :only-contents t |
||||
|
||||
The export date is set to be the same as the "current date" (so the |
||||
delta is 0). |
||||
** Unsuppress lastmod |
||||
:PROPERTIES: |
||||
:EXPORT_DATE: 2100-12-10 |
||||
:EXPORT_FILE_NAME: unsuppress-lastmod-in-subtree |
||||
:END: |
||||
#+begin_description |
||||
~lastmod~ front-matter parameter is *not* suppressed in this post. |
||||
#+end_description |
||||
|
||||
#+include: "./suppress-lastmod-period-non-zero.org::#common" :only-contents t |
||||
|
||||
The export date is set to be 11 days prior to the "current date". This |
||||
is more than the suppress period of 2 days. So this post will export |
||||
=lastmod=. |
||||
* Manually set lastmod :manual: |
||||
:PROPERTIES: |
||||
:EXPORT_HUGO_AUTO_SET_LASTMOD: nil |
||||
:END: |
||||
** Don't suppress lastmod as it is not set automatically |
||||
:PROPERTIES: |
||||
:EXPORT_FILE_NAME: lastmod-set-manually-dont-suppress |
||||
:EXPORT_DATE: 2100-12-21 |
||||
:EXPORT_HUGO_LASTMOD: 2100-12-21 |
||||
:END: |
||||
#+begin_description |
||||
~lastmod~ front-matter parameter is *not* suppressed in this post |
||||
because its value is set *manually*. |
||||
#+end_description |
||||
|
||||
#+include: "./suppress-lastmod-period-non-zero.org::#common" :only-contents t |
||||
|
||||
The value of ~org-hugo-suppress-lastmod-period~ is ignored in this |
||||
case as auto-setting of ~lastmod~ is disabled. |
||||
* Local Variables :ARCHIVE: |
||||
# Local Variables: |
||||
# org-hugo-suppress-lastmod-period: 172800.0 |
||||
# End: |
||||
@ -0,0 +1,33 @@ |
||||
#+title: Tests for org-hugo-suppress-lastmod-period set to 0.0 |
||||
|
||||
#+hugo_base_dir: ../ |
||||
|
||||
#+filetags: suppress lastmod zero |
||||
|
||||
#+author: |
||||
|
||||
* Common |
||||
:PROPERTIES: |
||||
:CUSTOM_ID: common |
||||
:END: |
||||
~org-hugo-suppress-lastmod-period~ is set to *0.0* seconds in Local |
||||
Variables. |
||||
* Auto set lastmod :autoset: |
||||
:PROPERTIES: |
||||
:EXPORT_HUGO_AUTO_SET_LASTMOD: t |
||||
:END: |
||||
** Suppress lastmod with auto-set-lastmod |
||||
:PROPERTIES: |
||||
:EXPORT_DATE: 2100-12-21 |
||||
:EXPORT_FILE_NAME: lastmod-not-suppressed-suppress-period-zero |
||||
:END: |
||||
#+begin_description |
||||
~lastmod~ front-matter parameter is *not* suppressed in this post as |
||||
=org-hugo-suppress-lastmod-period= is 0.0. |
||||
#+end_description |
||||
|
||||
#+include: "./suppress-lastmod-period-zero.org::#common" :only-contents t |
||||
* Local Variables :ARCHIVE: |
||||
# Local Variables: |
||||
# org-hugo-suppress-lastmod-period: 0.0 |
||||
# End: |
||||
@ -1,58 +0,0 @@ |
||||
#+hugo_base_dir: ../ |
||||
|
||||
* org-hugo-suppress-lastmod-period |
||||
** DONE suppress lastmod with auto-set-lastmod |
||||
CLOSED: [2118-09-01 Wed 08:35] |
||||
:PROPERTIES: |
||||
:EXPORT_FILE_NAME: suppress-lastmod-in-subtree-with-auto-lastmod |
||||
:EXPORT_HUGO_AUTO_SET_LASTMOD: t |
||||
:END: |
||||
|
||||
This post will never export =lastmod= when you initially change the |
||||
Org TODO state to =DONE= by saving the file because |
||||
=org-hugo-suppress-lastmod-period= is always greater than the time |
||||
difference between =date= and =lastmod= in the following condition. |
||||
|
||||
| Variable | Value | |
||||
|----------------------------------+-------| |
||||
| org-hugo-suppress-lastmod-period | 60.0 | |
||||
| org-hugo-auto-set-lastmod | t | |
||||
| org-hugo-auto-export-on-save | t | |
||||
| org-log-done | time | |
||||
|
||||
For instance, auto generated =date= would be =2018-09-01T08:00:00+00:00= |
||||
and =lastmod= could be =2018-09-01T08:00:59+00:00=. The time |
||||
difference is less than =org-hugo-suppress-lastmod-period= so |
||||
=lastmod= filed will not be exported. But if you change something in |
||||
this post after the initial exporting, the =lastmod= will be exported |
||||
because the time difference will exceed |
||||
=org-hugo-suppress-lastmod-period=. |
||||
|
||||
** DONE unsuppress lastmod |
||||
CLOSED: [1999-09-01 Sat 02:57] |
||||
:PROPERTIES: |
||||
:EXPORT_FILE_NAME: unsuppress-lastmod-in-subtree |
||||
:EXPORT_HUGO_AUTO_SET_LASTMOD: t |
||||
:END: |
||||
|
||||
This post will export =lastmod= because |
||||
=org-hugo-suppress-lastmod-period= is less than the time difference |
||||
between =[1999-09-01 Sat 02:57]= and the current date. |
||||
|
||||
** DONE ignore suppress lastmod |
||||
CLOSED: [2018-09-05 Wed 14:19] |
||||
:PROPERTIES: |
||||
:EXPORT_FILE_NAME: ignore-suppress-lastmod-in-subtree |
||||
:EXPORT_HUGO_LASTMOD: 1999-09-05 |
||||
:EXPORT_HUGO_AUTO_SET_LASTMOD: nil |
||||
:END: |
||||
|
||||
This post will export =lastmod= because =EXPORT_HUGO_LASTMOD= is |
||||
provided even if =org-hugo-suppress-lastmod-period= is less than the |
||||
time difference between =[2018-09-05 Wed 14:19]= and =1999-09-05=. |
||||
|
||||
* Local Variables :ARCHIVE: |
||||
# Local Variables: |
||||
# org-hugo-auto-set-lastmod: nil |
||||
# org-hugo-suppress-lastmod-period: 0.0 |
||||
# End: |
||||
@ -0,0 +1,14 @@ |
||||
+++ |
||||
title = "Suppress lastmod with auto-set-lastmod" |
||||
description = """ |
||||
`lastmod` front-matter parameter is **not** suppressed in this post as |
||||
`org-hugo-suppress-lastmod-period` is 0.0. |
||||
""" |
||||
date = 2100-12-21 |
||||
lastmod = 2100-12-21T00:00:00+00:00 |
||||
tags = ["suppress", "lastmod", "zero", "autoset"] |
||||
draft = false |
||||
+++ |
||||
|
||||
`org-hugo-suppress-lastmod-period` is set to **0.0** seconds in Local |
||||
Variables. |
||||
@ -0,0 +1,19 @@ |
||||
+++ |
||||
title = "Don't suppress lastmod as it is not set automatically" |
||||
description = """ |
||||
`lastmod` front-matter parameter is **not** suppressed in this post |
||||
because its value is set **manually**. |
||||
""" |
||||
date = 2100-12-21 |
||||
lastmod = 2100-12-21 |
||||
tags = ["suppress", "lastmod", "nonzero", "manual"] |
||||
draft = false |
||||
+++ |
||||
|
||||
`org-hugo-suppress-lastmod-period` is set to **172800.0** seconds (2 |
||||
days) in Local Variables. |
||||
|
||||
_For tests, the "current date" is always Dec 21, 2100._ |
||||
|
||||
The value of `org-hugo-suppress-lastmod-period` is ignored in this |
||||
case as auto-setting of `lastmod` is disabled. |
||||
@ -0,0 +1,15 @@ |
||||
+++ |
||||
title = "Suppress lastmod with auto-set-lastmod" |
||||
description = "`lastmod` front-matter parameter is suppressed in this post." |
||||
date = 2100-12-21 |
||||
tags = ["suppress", "lastmod", "nonzero", "autoset"] |
||||
draft = false |
||||
+++ |
||||
|
||||
`org-hugo-suppress-lastmod-period` is set to **172800.0** seconds (2 |
||||
days) in Local Variables. |
||||
|
||||
_For tests, the "current date" is always Dec 21, 2100._ |
||||
|
||||
The export date is set to be the same as the "current date" (so the |
||||
delta is 0). |
||||
@ -0,0 +1,17 @@ |
||||
+++ |
||||
title = "Unsuppress lastmod" |
||||
description = "`lastmod` front-matter parameter is **not** suppressed in this post." |
||||
date = 2100-12-10 |
||||
lastmod = 2100-12-21T00:00:00+00:00 |
||||
tags = ["suppress", "lastmod", "nonzero", "autoset"] |
||||
draft = false |
||||
+++ |
||||
|
||||
`org-hugo-suppress-lastmod-period` is set to **172800.0** seconds (2 |
||||
days) in Local Variables. |
||||
|
||||
_For tests, the "current date" is always Dec 21, 2100._ |
||||
|
||||
The export date is set to be 11 days prior to the "current date". This |
||||
is more than the suppress period of 2 days. So this post will export |
||||
`lastmod`. |
||||
Loading…
Reference in new issue