From 01662ab78af4f35312888d7e862fe3c5f68cbd53 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Thu, 1 Mar 2018 17:30:01 -0500 Subject: [PATCH] Support setting taxonomy weights Fixes https://github.com/kaushalmodi/ox-hugo/issues/141 Regular page weight setting is same as before: Manual: #+hugo_weight: 100 Auto: #+hugo_weight: auto Taxonomy weight setting: Manual: #+hugo_weight: :tags 100 :categories 100 :series 100 Auto: #+hugo_weight: :tags auto :categories auto :series auto Regular page weight and Taxonomy weights together: #+hugo_weight: 50 :tags 100 :categories 100 :series 100 or if *not* specifying the page weight in the very beginning, use the :page keyword: #+hugo_weight: :tags 100 :categories 100 :page 50 :series 100 --- doc/ox-hugo-manual.org | 26 +++-- ox-hugo.el | 68 ++++++++++---- test/site/content-org/all-posts.org | 94 +++++++++++++++++++ test/site/content-org/keyword-collection.org | 8 +- ...eight-ineffective-for-per-file-exports.org | 6 +- ...weight-ineffective-for-per-file-exports.md | 6 +- test/site/content/posts/hugo-post-weight-1.md | 2 +- .../content/posts/hugo-post-weight-123.md | 2 +- test/site/content/posts/hugo-post-weight-2.md | 2 +- test/site/content/posts/hugo-post-weight-3.md | 2 +- test/site/content/posts/hugo-post-weight-4.md | 2 +- .../content/posts/hugo-post-weight-4567.md | 2 +- test/site/content/posts/hugo-post-weight-5.md | 2 +- test/site/content/posts/keyword-collection.md | 6 +- ...-calc-of-weight--hugo-weight-as-keyword.md | 2 +- ...-calc-of-weight--hugo-weight-as-keyword.md | 2 +- ...-calc-of-weight--hugo-weight-as-keyword.md | 2 +- ...-calc-of-weight--hugo-weight-as-keyword.md | 2 +- ...-calc-of-weight--hugo-weight-as-keyword.md | 2 +- .../posts/taxonomy-and-page-weights-1.md | 12 +++ .../posts/taxonomy-and-page-weights-2.md | 11 +++ .../posts/taxonomy-and-page-weights-3.md | 13 +++ .../posts/taxonomy-and-page-weights-4.md | 11 +++ .../posts/taxonomy-and-page-weights-auto-1.md | 13 +++ .../posts/taxonomy-and-page-weights-auto-2.md | 11 +++ .../posts/taxonomy-categories-weight-222.md | 6 ++ .../taxonomy-categories-weight-auto-1.md | 6 ++ .../taxonomy-categories-weight-auto-2.md | 6 ++ .../content/posts/taxonomy-tags-weight-111.md | 6 ++ .../posts/taxonomy-tags-weight-auto-1.md | 6 ++ .../posts/taxonomy-tags-weight-auto-2.md | 6 ++ 31 files changed, 297 insertions(+), 48 deletions(-) create mode 100644 test/site/content/posts/taxonomy-and-page-weights-1.md create mode 100644 test/site/content/posts/taxonomy-and-page-weights-2.md create mode 100644 test/site/content/posts/taxonomy-and-page-weights-3.md create mode 100644 test/site/content/posts/taxonomy-and-page-weights-4.md create mode 100644 test/site/content/posts/taxonomy-and-page-weights-auto-1.md create mode 100644 test/site/content/posts/taxonomy-and-page-weights-auto-2.md create mode 100644 test/site/content/posts/taxonomy-categories-weight-222.md create mode 100644 test/site/content/posts/taxonomy-categories-weight-auto-1.md create mode 100644 test/site/content/posts/taxonomy-categories-weight-auto-2.md create mode 100644 test/site/content/posts/taxonomy-tags-weight-111.md create mode 100644 test/site/content/posts/taxonomy-tags-weight-auto-1.md create mode 100644 test/site/content/posts/taxonomy-tags-weight-auto-2.md diff --git a/doc/ox-hugo-manual.org b/doc/ox-hugo-manual.org index 2f1af08..ba9dcd1 100644 --- a/doc/ox-hugo-manual.org +++ b/doc/ox-hugo-manual.org @@ -645,9 +645,10 @@ translate to Hugo front-matter: like menu entry, category, section name, etc. - A subtree can be quickly marked to be in TODO state (default binding =C-c C-t=). A *TODO* post is marked as a /draft/ Hugo post. -- The /menu-item weights/ and/or /post weights/ can be set to be - auto-calculated so that the menu items or post order in the final - HTML appear in the same order as the respective subtrees in Org. +- The /menu-item weights/, /page weights/ and /taxonomy weights/ can + be set to be auto-calculated so that the menu items or post order in + the final HTML appear in the same order as the respective subtrees + in Org. If the subtrees are re-ordered in Org, the weights get changed too. - One can have a subtree with section property set to "posts" and all @@ -735,7 +736,7 @@ There are 2 major blogging flows that can be used with this package: - This works but you won't be able to leverage Org-specific benefits like tag and property inheritance, use of TODO states to translate to post =draft= state, auto weight calculation for - posts and menu items, etc. + pages, taxonomies and menu items, etc. See the {{{doc(org-capture-setup,Org Capture Setup)}}} page to see how to quickly create new posts. @@ -837,7 +838,10 @@ set. | =categories = ["x", "y"]= | =* foo :@x:@y:= | Subtree heading tags with =@= prefix | | =draft = true= | =* TODO foo= | Subtree heading Org Todo state set to =TODO= (or =DRAFT=) | | =draft = false= | =* foo= | Subtree heading Org Todo state *not* set to =TODO= (or =DRAFT=) | -| =weight = 123= | =:EXPORT_HUGO_WEIGHT: auto= | When set to =auto=, weight is auto-calculated | +| =weight = 123= (manual) | =:EXPORT_HUGO_WEIGHT: 123= | Manual setting of page weight | +| =weight = 123= (auto-calc) | =:EXPORT_HUGO_WEIGHT: auto= | When set to =auto=, page weight is auto-calculated | +| =tags_weight = 123= (manual) | =:EXPORT_HUGO_WEIGHT: :tags 123= | Manual setting of /FOO/ taxonomy weight, by setting to =:FOO VALUE= | +| =tags_weight = 123= (auto-calc) | =:EXPORT_HUGO_WEIGHT: :tags auto= | When set to =:FOO auto=, /FOO/ taxonomy weight is auto-calculated | | =weight = 123= (in =[menu.foo]=) | =:EXPORT_HUGO_MENU: :menu foo= | Menu weight is auto-calculated unless specified | |------------------------------------+----------------------------------------+----------------------------------------------------------------------------| ***** Notes @@ -859,13 +863,17 @@ set. | =draft = true= | =#+hugo_draft: true= | | =draft = false= | =#+hugo_draft: false= (default) | | =weight = 123= | =#+hugo_weight: 123= | +| =tags_weight = 123= | =#+hugo_weight: :tags 123= | +| =categories_weight = 123= | =#+hugo_weight: :categories 123= | | =weight = 123= (in =[menu.foo]=) | =#+hugo_menu: :menu foo :weight 123= | |----------------------------------+--------------------------------------| ***** Notes -- The auto weight calculation for posts and menu items works *only* - for subtree exports. For the file-based export flow, one needs to - specify the weights manually. The value of /weight/ set to ="auto"= - will be equivalent to /nil/ for the file-based export flow. +- The *auto calculation* of weights for pages, taxonomies and menu + items works *only* for subtree-based exports. + + For the file-based exports, the weights have to be specified + manually. Any /weight/ assignment to ="auto"= for file-based exports + is ignored. - See {{{doc(dates#org-hugo-date-format,=org-hugo-date-format=)}}} for customizing the date formats for all /date/ front-matter parameters. *** Formatting diff --git a/ox-hugo.el b/ox-hugo.el index c91cbf6..e882a76 100644 --- a/ox-hugo.el +++ b/ox-hugo.el @@ -812,7 +812,7 @@ newer." ;; videos (:hugo-videos "HUGO_VIDEOS" nil nil newline) ;; weight - (:hugo-weight "HUGO_WEIGHT" nil nil))) + (:hugo-weight "HUGO_WEIGHT" nil nil space))) ;;; Miscellaneous Helper Functions @@ -2677,15 +2677,45 @@ INFO is a plist used as a communication channel." ;; (message "dbg: categories: categories-list = %s" categories-list) categories-list))) (keywords (org-hugo--delim-str-to-list (plist-get info :keywords))) - (weight (let* ((wt (plist-get info :hugo-weight)) - (auto-calc (and (stringp wt) - (string= wt "auto") - org-hugo--subtree-coord))) - (if auto-calc - (org-hugo--calc-weight) - (unless (and (stringp wt) ;Don't allow weight to be "auto" if auto-calc is nil. - (string= wt "auto")) - wt)))) + (weight-data (let ((wt-raw-list (org-hugo--parse-property-arguments (plist-get info :hugo-weight))) + weight-data-1) + (dolist (wt-raw wt-raw-list) + (let (key value) + ;; (message "weight DBG wt-raw: %S" wt-raw) + ;; (message "weight DBG cdr wt-raw: %S" (cdr wt-raw)) + ;; (message "weight DBG org-hugo--subtree-coord: %S" org-hugo--subtree-coord) + (cond + ((null (cdr wt-raw)) ;`wt-raw' is not of the type (TAXONOMY . WEIGHT) + (setq key 'weight) + (setq value (cond + ((and org-hugo--subtree-coord + (equal (car wt-raw) 'auto)) ;(auto) + (org-hugo--calc-weight)) + ((and (equal (car wt-raw) 'auto) ;Auto weight ineffective for file-based exports + (null org-hugo--subtree-coord)) + nil) + (t + (string-to-number (symbol-name (car wt-raw))))))) + (t + (setq key (if (equal (car wt-raw) 'page) ;`wt-raw' is of the type (page . WEIGHT) + 'weight + (intern (format "%s_weight" (symbol-name (car wt-raw)))))) + (setq value (cond + ((and org-hugo--subtree-coord + (equal (cdr wt-raw) "auto")) ;(TAXONOMY . "auto") or (page . "auto") + (org-hugo--calc-weight)) + ((numberp (cdr wt-raw)) + (cdr wt-raw)) + ((and (equal (cdr wt-raw) "auto") ;Auto weight ineffective for file-based exports + (null org-hugo--subtree-coord)) + nil) + (t + (user-error "ox-hugo: Invalid weight %S" (cdr wt-raw))))))) + ;; (message "weight DBG key: %S" key) + ;; (message "weight DBG value: %S" value) + (push (cons key value) weight-data-1))) + ;; (message "weight DBG weight-data: %S" weight-data-1) + weight-data-1)) (menu-alist (org-hugo--parse-menu-prop-to-alist (plist-get info :hugo-menu))) (menu-alist-override (org-hugo--parse-menu-prop-to-alist (plist-get info :hugo-menu-override))) ;; If menu-alist-override is non-nil, update menu-alist with values from that. @@ -2727,7 +2757,6 @@ INFO is a plist used as a communication channel." (type . ,(plist-get info :hugo-type)) (url . ,(plist-get info :hugo-url)) (videos . ,(org-hugo--delim-str-to-list (plist-get info :hugo-videos))) - (weight . ,weight) (draft . ,draft) (headless . ,headless) (creator . ,creator) @@ -2735,7 +2764,7 @@ INFO is a plist used as a communication channel." (blackfriday . ,blackfriday) (menu . ,menu-alist) (resources . ,resources))) - (data `,(append data custom-fm-data))) + (data `,(append data weight-data custom-fm-data))) ;; (message "[get fm DBG] tags: %s" tags) ;; (message "dbg: todo-state: keyword=%S draft=%S" todo-keyword draft) ;; (message "dbg: hugo tags: %S" (plist-get info :hugo-tags)) @@ -3315,8 +3344,8 @@ approach)." (message "[ox-hugo] %d/ Exporting `%s' .." org-hugo--subtree-count title)) (message "[ox-hugo] Exporting `%s' .." title)) ;; Get the current subtree coordinates for - ;; auto-calculation of menu item weight or post - ;; weight. + ;; auto-calculation of menu item weight, page + ;; or taxonomy weights. (when (or ;; Check if the menu front-matter is specified. (or @@ -3325,15 +3354,16 @@ approach)." (goto-char (point-min)) (let ((case-fold-search t)) (re-search-forward "^#\\+hugo_menu:.*:menu" nil :noerror)))) - ;; Check if the post needs auto-calculation of weight. + ;; Check if auto-calculation is needed + ;; for page or taxonomy weights. (or - (let ((post-weight (org-entry-get nil "EXPORT_HUGO_WEIGHT" :inherit))) - (and (stringp post-weight) - (string= post-weight "auto"))) + (let ((page-or-taxonomy-weight (org-entry-get nil "EXPORT_HUGO_WEIGHT" :inherit))) + (and (stringp page-or-taxonomy-weight) + (string-match-p "auto" page-or-taxonomy-weight))) (save-excursion (goto-char (point-min)) (let ((case-fold-search t)) - (re-search-forward "^#\\+hugo_weight:[[:blank:]]*auto" nil :noerror))))) + (re-search-forward "^#\\+hugo_weight:.*auto" nil :noerror))))) (setq org-hugo--subtree-coord (org-hugo--get-post-subtree-coordinates subtree))) ;; Get the current subtree section name if any. diff --git a/test/site/content-org/all-posts.org b/test/site/content-org/all-posts.org index ae9245e..3046b13 100644 --- a/test/site/content-org/all-posts.org +++ b/test/site/content-org/all-posts.org @@ -3825,6 +3825,100 @@ Below, the code block language name will show up before the code. :PROPERTIES: :EXPORT_FILE_NAME: hugo-post-weight-5 :END: +** Taxonomy Weight (Not the post or menu item weight) :taxonomy_weight: +*** Manually specified taxonomy weights :manual: +**** Taxonomy (tags) weight set 111 :tags: +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: :tags 111 +:EXPORT_FILE_NAME: taxonomy-tags-weight-111 +:END: +**** Taxonomy (categories) weight set 222 :categories: +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: :categories 222 +:EXPORT_FILE_NAME: taxonomy-categories-weight-222 +:END: +**** Taxonomy weights and page weight :tags:page_weight:categories: +***** Taxonomy weights and page weight 1 +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: 77 :tags 111 :categories 999 +:EXPORT_FILE_NAME: taxonomy-and-page-weights-1 +:END: +If you want to specify page weight along with taxonomy weights, *and* +if you do not use the =:page= keyword before the weight value, the +page weight *must* be specified as the very first weight. +***** Taxonomy weights and page weight 2 +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: :tags 111 :categories 999 :page 77 +:EXPORT_FILE_NAME: taxonomy-and-page-weights-2 +:END: +The page weight does not have to be specified as the very first weight +if using the =:page= keyword before the weight value. +***** Taxonomy weights and page weight 3 +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: 77 +:EXPORT_HUGO_WEIGHT+: :tags 111 +:EXPORT_HUGO_WEIGHT+: :categories 999 +:EXPORT_FILE_NAME: taxonomy-and-page-weights-3 +:END: +If you want to specify page weight along with taxonomy weights, *and* +if you do not use the =:page= keyword before the weight value, the +page weight *must* be specified as the very first weight, even when +you specify the weights separately on each line. +***** Taxonomy weights and page weight 4 +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: :tags 111 +:EXPORT_HUGO_WEIGHT+: :page 77 +:EXPORT_HUGO_WEIGHT+: :categories 999 +:EXPORT_FILE_NAME: taxonomy-and-page-weights-4 +:END: +The page weight does not have to be specified as the very first weight +if using the =:page= keyword before the weight value. +*** Auto taxonomy weight calculation :auto: +**** Tags :tags: +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: :tags auto +:END: +***** Post with auto taxonomy (tags) weight calc 1 +:PROPERTIES: +:EXPORT_FILE_NAME: taxonomy-tags-weight-auto-1 +:END: +***** Post with auto taxonomy (tags) weight calc 2 +:PROPERTIES: +:EXPORT_FILE_NAME: taxonomy-tags-weight-auto-2 +:END: +**** Categories :categories: +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: :categories auto +:END: +***** Post with auto taxonomy (categories) weight calc 1 +:PROPERTIES: +:EXPORT_FILE_NAME: taxonomy-categories-weight-auto-1 +:END: +***** Post with auto taxonomy (categories) weight calc 2 +:PROPERTIES: +:EXPORT_FILE_NAME: taxonomy-categories-weight-auto-2 +:END: +**** Taxonomy weights and page weight :page_weight:tags:categories: +***** Taxonomy weights and page weight (auto) 1 +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: auto +:EXPORT_HUGO_WEIGHT+: :tags auto +:EXPORT_HUGO_WEIGHT+: :categories auto +:EXPORT_FILE_NAME: taxonomy-and-page-weights-auto-1 +:END: +If you want to specify page weight along with taxonomy weights, *and* +if you do not use the =:page= keyword before the weight value, the +page weight *must* be specified as the very first weight, even when +you specify the weights separately on each line. +***** Taxonomy weights and page weight (auto) 2 +:PROPERTIES: +:EXPORT_HUGO_WEIGHT: :tags auto +:EXPORT_HUGO_WEIGHT+: :page auto +:EXPORT_HUGO_WEIGHT+: :categories auto +:EXPORT_FILE_NAME: taxonomy-and-page-weights-auto-2 +:END: +The page weight does not have to be specified as the very first weight +if using the =:page= keyword before the weight value. * Dates :dates: ** Date :date: *** Just date diff --git a/test/site/content-org/keyword-collection.org b/test/site/content-org/keyword-collection.org index cff4833..4f68f6c 100644 --- a/test/site/content-org/keyword-collection.org +++ b/test/site/content-org/keyword-collection.org @@ -89,12 +89,17 @@ #+hugo_series: "series 1" #+hugo_series: "series 2" +# Weight +#+hugo_weight: 7 +#+hugo_weight: :tags 88 +#+hugo_weight: :categories 999 + This is a test post that tests that keywords set across multiple Org keywords get collected. #+hugo: more -* Keyword Collection Tested to work [15/15] +* Keyword Collection Tested to work [16/16] - [X] =#+author= - [X] =#+hugo_tags= - [X] =#+hugo_categories= @@ -110,3 +115,4 @@ keywords get collected. - [X] =#+hugo_images= - [X] =#+hugo_videos= - [X] =#+hugo_series= +- [X] =#+hugo_weight= diff --git a/test/site/content-org/single-posts/hugo-auto-weight-ineffective-for-per-file-exports.org b/test/site/content-org/single-posts/hugo-auto-weight-ineffective-for-per-file-exports.org index a6403c4..d6c3bfc 100644 --- a/test/site/content-org/single-posts/hugo-auto-weight-ineffective-for-per-file-exports.org +++ b/test/site/content-org/single-posts/hugo-auto-weight-ineffective-for-per-file-exports.org @@ -3,10 +3,10 @@ #+hugo_base_dir: ../../ #+hugo_weight: auto -#+hugo_tags: weight +#+hugo_tags: weight ineffective Even though we have =#+hugo_weight: auto= in this file, the weight -will be treated as nil as this file is exported using the /per-file/ -or /complete-file/ export flow. +will be treated as nil as this file is exported using the /file-based/ +export. The auto-weight calculation works *only* for /per-subtree/ flow. diff --git a/test/site/content/posts/hugo-auto-weight-ineffective-for-per-file-exports.md b/test/site/content/posts/hugo-auto-weight-ineffective-for-per-file-exports.md index dda34db..04d60ef 100644 --- a/test/site/content/posts/hugo-auto-weight-ineffective-for-per-file-exports.md +++ b/test/site/content/posts/hugo-auto-weight-ineffective-for-per-file-exports.md @@ -1,11 +1,11 @@ +++ title = "Hugo auto weight ineffective for per-file exports" -tags = ["weight"] +tags = ["weight", "ineffective"] draft = false +++ Even though we have `#+hugo_weight: auto` in this file, the weight -will be treated as nil as this file is exported using the _per-file_ -or _complete-file_ export flow. +will be treated as nil as this file is exported using the _file-based_ +export. The auto-weight calculation works **only** for _per-subtree_ flow. diff --git a/test/site/content/posts/hugo-post-weight-1.md b/test/site/content/posts/hugo-post-weight-1.md index bbe1ce3..50a7388 100644 --- a/test/site/content/posts/hugo-post-weight-1.md +++ b/test/site/content/posts/hugo-post-weight-1.md @@ -1,6 +1,6 @@ +++ title = "Post with auto weight calc 1 (EXPORT_HUGO_WEIGHT as subtree property)" tags = ["weight", "page-weight", "auto"] -weight = 4001 draft = false +weight = 4001 +++ diff --git a/test/site/content/posts/hugo-post-weight-123.md b/test/site/content/posts/hugo-post-weight-123.md index 651ef71..6744c84 100644 --- a/test/site/content/posts/hugo-post-weight-123.md +++ b/test/site/content/posts/hugo-post-weight-123.md @@ -1,6 +1,6 @@ +++ title = "Post with weight 123" tags = ["weight", "page-weight", "manual"] -weight = 123 draft = false +weight = 123 +++ diff --git a/test/site/content/posts/hugo-post-weight-2.md b/test/site/content/posts/hugo-post-weight-2.md index 130e50e..9a89eae 100644 --- a/test/site/content/posts/hugo-post-weight-2.md +++ b/test/site/content/posts/hugo-post-weight-2.md @@ -1,6 +1,6 @@ +++ title = "Post with auto weight calc 2 (EXPORT_HUGO_WEIGHT as subtree property)" tags = ["weight", "page-weight", "auto"] -weight = 4002 draft = false +weight = 4002 +++ diff --git a/test/site/content/posts/hugo-post-weight-3.md b/test/site/content/posts/hugo-post-weight-3.md index a4d77e2..84f92c8 100644 --- a/test/site/content/posts/hugo-post-weight-3.md +++ b/test/site/content/posts/hugo-post-weight-3.md @@ -1,6 +1,6 @@ +++ title = "Post with auto weight calc 3 (EXPORT_HUGO_WEIGHT as subtree property)" tags = ["weight", "page-weight", "auto"] -weight = 4003 draft = false +weight = 4003 +++ diff --git a/test/site/content/posts/hugo-post-weight-4.md b/test/site/content/posts/hugo-post-weight-4.md index f24ccc8..fdf3955 100644 --- a/test/site/content/posts/hugo-post-weight-4.md +++ b/test/site/content/posts/hugo-post-weight-4.md @@ -1,6 +1,6 @@ +++ title = "Post with auto weight calc 4 (EXPORT_HUGO_WEIGHT as subtree property)" tags = ["weight", "page-weight", "auto"] -weight = 4004 draft = false +weight = 4004 +++ diff --git a/test/site/content/posts/hugo-post-weight-4567.md b/test/site/content/posts/hugo-post-weight-4567.md index 7d7b937..6fa8349 100644 --- a/test/site/content/posts/hugo-post-weight-4567.md +++ b/test/site/content/posts/hugo-post-weight-4567.md @@ -1,6 +1,6 @@ +++ title = "Post with weight 4567" tags = ["weight", "page-weight", "manual"] -weight = 4567 draft = false +weight = 4567 +++ diff --git a/test/site/content/posts/hugo-post-weight-5.md b/test/site/content/posts/hugo-post-weight-5.md index 4d74d78..99326e5 100644 --- a/test/site/content/posts/hugo-post-weight-5.md +++ b/test/site/content/posts/hugo-post-weight-5.md @@ -1,6 +1,6 @@ +++ title = "Post with auto weight calc 5 (EXPORT_HUGO_WEIGHT as subtree property)" tags = ["weight", "page-weight", "auto"] -weight = 4005 draft = false +weight = 4005 +++ diff --git a/test/site/content/posts/keyword-collection.md b/test/site/content/posts/keyword-collection.md index 3ee8b48..4bd344d 100644 --- a/test/site/content/posts/keyword-collection.md +++ b/test/site/content/posts/keyword-collection.md @@ -10,6 +10,9 @@ tags = ["mega front-matter", "keys", "collection", "concatenation", "merging"] categories = ["cat1", "cat2"] videos = ["video 1", "video 2"] draft = false +categories_weight = 999 +tags_weight = 88 +weight = 7 myfoo = "bar" mybaz = "zoo" alpha = 1 @@ -72,7 +75,7 @@ keywords get collected. -## Keyword Collection Tested to work [15/15] {#keyword-collection-tested-to-work} +## Keyword Collection Tested to work [16/16] {#keyword-collection-tested-to-work} - [X] `#+author` - [X] `#+hugo_tags` @@ -89,3 +92,4 @@ keywords get collected. - [X] `#+hugo_images` - [X] `#+hugo_videos` - [X] `#+hugo_series` +- [X] `#+hugo_weight` diff --git a/test/site/content/posts/post-1-with-auto-calc-of-weight--hugo-weight-as-keyword.md b/test/site/content/posts/post-1-with-auto-calc-of-weight--hugo-weight-as-keyword.md index 3109210..81a3bac 100644 --- a/test/site/content/posts/post-1-with-auto-calc-of-weight--hugo-weight-as-keyword.md +++ b/test/site/content/posts/post-1-with-auto-calc-of-weight--hugo-weight-as-keyword.md @@ -1,6 +1,6 @@ +++ title = "Post 1 with auto calculation of weight (HUGO_WEIGHT as keyword)" tags = ["weight"] -weight = 1001 draft = false +weight = 1001 +++ diff --git a/test/site/content/posts/post-2-with-auto-calc-of-weight--hugo-weight-as-keyword.md b/test/site/content/posts/post-2-with-auto-calc-of-weight--hugo-weight-as-keyword.md index 6c8a44f..0baee41 100644 --- a/test/site/content/posts/post-2-with-auto-calc-of-weight--hugo-weight-as-keyword.md +++ b/test/site/content/posts/post-2-with-auto-calc-of-weight--hugo-weight-as-keyword.md @@ -1,6 +1,6 @@ +++ title = "Post 2 with auto calculation of weight (HUGO_WEIGHT as keyword)" tags = ["weight"] -weight = 1002 draft = false +weight = 1002 +++ diff --git a/test/site/content/posts/post-3-with-auto-calc-of-weight--hugo-weight-as-keyword.md b/test/site/content/posts/post-3-with-auto-calc-of-weight--hugo-weight-as-keyword.md index 3d50bb6..95a3ae7 100644 --- a/test/site/content/posts/post-3-with-auto-calc-of-weight--hugo-weight-as-keyword.md +++ b/test/site/content/posts/post-3-with-auto-calc-of-weight--hugo-weight-as-keyword.md @@ -1,6 +1,6 @@ +++ title = "Post 3 with auto calculation of weight (HUGO_WEIGHT as keyword)" tags = ["weight"] -weight = 1003 draft = false +weight = 1003 +++ diff --git a/test/site/content/posts/post-4-with-auto-calc-of-weight--hugo-weight-as-keyword.md b/test/site/content/posts/post-4-with-auto-calc-of-weight--hugo-weight-as-keyword.md index 558c3ba..99f5a20 100644 --- a/test/site/content/posts/post-4-with-auto-calc-of-weight--hugo-weight-as-keyword.md +++ b/test/site/content/posts/post-4-with-auto-calc-of-weight--hugo-weight-as-keyword.md @@ -1,6 +1,6 @@ +++ title = "Post 4 with auto calculation of weight (HUGO_WEIGHT as keyword)" tags = ["weight"] -weight = 1004 draft = false +weight = 1004 +++ diff --git a/test/site/content/posts/post-5-with-auto-calc-of-weight--hugo-weight-as-keyword.md b/test/site/content/posts/post-5-with-auto-calc-of-weight--hugo-weight-as-keyword.md index 4b02d9e..6c9457a 100644 --- a/test/site/content/posts/post-5-with-auto-calc-of-weight--hugo-weight-as-keyword.md +++ b/test/site/content/posts/post-5-with-auto-calc-of-weight--hugo-weight-as-keyword.md @@ -1,6 +1,6 @@ +++ title = "Post 5 with auto calculation of weight (HUGO_WEIGHT as keyword)" tags = ["weight"] -weight = 1005 draft = false +weight = 1005 +++ diff --git a/test/site/content/posts/taxonomy-and-page-weights-1.md b/test/site/content/posts/taxonomy-and-page-weights-1.md new file mode 100644 index 0000000..725f8b2 --- /dev/null +++ b/test/site/content/posts/taxonomy-and-page-weights-1.md @@ -0,0 +1,12 @@ ++++ +title = "Taxonomy weights and page weight 1" +tags = ["weight", "taxonomy-weight", "manual", "tags", "page-weight", "categories"] +draft = false +categories_weight = 999 +tags_weight = 111 +weight = 77 ++++ + +If you want to specify page weight along with taxonomy weights, **and** +if you do not use the `:page` keyword before the weight value, the +page weight **must** be specified as the very first weight. diff --git a/test/site/content/posts/taxonomy-and-page-weights-2.md b/test/site/content/posts/taxonomy-and-page-weights-2.md new file mode 100644 index 0000000..4c59c91 --- /dev/null +++ b/test/site/content/posts/taxonomy-and-page-weights-2.md @@ -0,0 +1,11 @@ ++++ +title = "Taxonomy weights and page weight 2" +tags = ["weight", "taxonomy-weight", "manual", "tags", "page-weight", "categories"] +draft = false +weight = 77 +categories_weight = 999 +tags_weight = 111 ++++ + +The page weight does not have to be specified as the very first weight +if using the `:page` keyword before the weight value. diff --git a/test/site/content/posts/taxonomy-and-page-weights-3.md b/test/site/content/posts/taxonomy-and-page-weights-3.md new file mode 100644 index 0000000..d68605a --- /dev/null +++ b/test/site/content/posts/taxonomy-and-page-weights-3.md @@ -0,0 +1,13 @@ ++++ +title = "Taxonomy weights and page weight 3" +tags = ["weight", "taxonomy-weight", "manual", "tags", "page-weight", "categories"] +draft = false +categories_weight = 999 +tags_weight = 111 +weight = 77 ++++ + +If you want to specify page weight along with taxonomy weights, **and** +if you do not use the `:page` keyword before the weight value, the +page weight **must** be specified as the very first weight, even when +you specify the weights separately on each line. diff --git a/test/site/content/posts/taxonomy-and-page-weights-4.md b/test/site/content/posts/taxonomy-and-page-weights-4.md new file mode 100644 index 0000000..29ab4c8 --- /dev/null +++ b/test/site/content/posts/taxonomy-and-page-weights-4.md @@ -0,0 +1,11 @@ ++++ +title = "Taxonomy weights and page weight 4" +tags = ["weight", "taxonomy-weight", "manual", "tags", "page-weight", "categories"] +draft = false +categories_weight = 999 +weight = 77 +tags_weight = 111 ++++ + +The page weight does not have to be specified as the very first weight +if using the `:page` keyword before the weight value. diff --git a/test/site/content/posts/taxonomy-and-page-weights-auto-1.md b/test/site/content/posts/taxonomy-and-page-weights-auto-1.md new file mode 100644 index 0000000..b694f22 --- /dev/null +++ b/test/site/content/posts/taxonomy-and-page-weights-auto-1.md @@ -0,0 +1,13 @@ ++++ +title = "Taxonomy weights and page weight (auto) 1" +tags = ["weight", "taxonomy-weight", "auto", "page-weight", "tags", "categories"] +draft = false +categories_weight = 5001 +tags_weight = 5001 +weight = 5001 ++++ + +If you want to specify page weight along with taxonomy weights, **and** +if you do not use the `:page` keyword before the weight value, the +page weight **must** be specified as the very first weight, even when +you specify the weights separately on each line. diff --git a/test/site/content/posts/taxonomy-and-page-weights-auto-2.md b/test/site/content/posts/taxonomy-and-page-weights-auto-2.md new file mode 100644 index 0000000..6e25b53 --- /dev/null +++ b/test/site/content/posts/taxonomy-and-page-weights-auto-2.md @@ -0,0 +1,11 @@ ++++ +title = "Taxonomy weights and page weight (auto) 2" +tags = ["weight", "taxonomy-weight", "auto", "page-weight", "tags", "categories"] +draft = false +categories_weight = 5002 +weight = 5002 +tags_weight = 5002 ++++ + +The page weight does not have to be specified as the very first weight +if using the `:page` keyword before the weight value. diff --git a/test/site/content/posts/taxonomy-categories-weight-222.md b/test/site/content/posts/taxonomy-categories-weight-222.md new file mode 100644 index 0000000..f5e6239 --- /dev/null +++ b/test/site/content/posts/taxonomy-categories-weight-222.md @@ -0,0 +1,6 @@ ++++ +title = "Taxonomy (categories) weight set 222" +tags = ["weight", "taxonomy-weight", "manual", "categories"] +draft = false +categories_weight = 222 ++++ diff --git a/test/site/content/posts/taxonomy-categories-weight-auto-1.md b/test/site/content/posts/taxonomy-categories-weight-auto-1.md new file mode 100644 index 0000000..0af24cd --- /dev/null +++ b/test/site/content/posts/taxonomy-categories-weight-auto-1.md @@ -0,0 +1,6 @@ ++++ +title = "Post with auto taxonomy (categories) weight calc 1" +tags = ["weight", "taxonomy-weight", "auto", "categories"] +draft = false +categories_weight = 5001 ++++ diff --git a/test/site/content/posts/taxonomy-categories-weight-auto-2.md b/test/site/content/posts/taxonomy-categories-weight-auto-2.md new file mode 100644 index 0000000..cefadb8 --- /dev/null +++ b/test/site/content/posts/taxonomy-categories-weight-auto-2.md @@ -0,0 +1,6 @@ ++++ +title = "Post with auto taxonomy (categories) weight calc 2" +tags = ["weight", "taxonomy-weight", "auto", "categories"] +draft = false +categories_weight = 5002 ++++ diff --git a/test/site/content/posts/taxonomy-tags-weight-111.md b/test/site/content/posts/taxonomy-tags-weight-111.md new file mode 100644 index 0000000..98b113c --- /dev/null +++ b/test/site/content/posts/taxonomy-tags-weight-111.md @@ -0,0 +1,6 @@ ++++ +title = "Taxonomy (tags) weight set 111" +tags = ["weight", "taxonomy-weight", "manual", "tags"] +draft = false +tags_weight = 111 ++++ diff --git a/test/site/content/posts/taxonomy-tags-weight-auto-1.md b/test/site/content/posts/taxonomy-tags-weight-auto-1.md new file mode 100644 index 0000000..a35c0e4 --- /dev/null +++ b/test/site/content/posts/taxonomy-tags-weight-auto-1.md @@ -0,0 +1,6 @@ ++++ +title = "Post with auto taxonomy (tags) weight calc 1" +tags = ["weight", "taxonomy-weight", "auto", "tags"] +draft = false +tags_weight = 5001 ++++ diff --git a/test/site/content/posts/taxonomy-tags-weight-auto-2.md b/test/site/content/posts/taxonomy-tags-weight-auto-2.md new file mode 100644 index 0000000..c1064e2 --- /dev/null +++ b/test/site/content/posts/taxonomy-tags-weight-auto-2.md @@ -0,0 +1,6 @@ ++++ +title = "Post with auto taxonomy (tags) weight calc 2" +tags = ["weight", "taxonomy-weight", "auto", "tags"] +draft = false +tags_weight = 5002 ++++