Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom taxonomies #93

Open
wants to merge 13 commits into
base: gh-pages
Choose a base branch
from
Open

Custom taxonomies #93

wants to merge 13 commits into from

Conversation

sc0ttj
Copy link
Owner

@sc0ttj sc0ttj commented Oct 27, 2019

NOT READY

Still to do:

  • see if the page_types branch is worth merging into this this
  • merge it in to this branch if it's good, else don't
  • either way, test all the features of this branch before merging into gh-pages

For more info about taxonomies, see Issue #92

To test out the new index page generation routines, based on YAML defined taxonomies:

source .site_config
rebuild_index_pages

It is currently setup to build the same index pages which already exist - authors, categories, tags..

It should build identical index pages to the rebuild authors, rebuild tags (etc) commands, with some small changes:

  • the headings and meta descriptions are a little nicer
  • data all from YAML, not from posts.csv (except post_count, see To do)
  • this builds slightly different lists on some index pages, cos the front matter and posts.csv are out of sync

Done

  • rebuilds all supported index pages OK (foo/index.html)
  • rebuilds all index items pages OK (foo/bar.html)
  • all features of rebuild command re-implemented:
    • supports partial rebuilds, like rebuilds tags, and rebuild tags:markdown,bash
    • supports auto-updating a pages relevant index pages when created
  • remove all hard-coded author/category/tags stuff

To do

Page types

[in progress] See PR #94

  • steal "page archetypes" stuff from Hugo (see Custom taxonomies #92 )
  • update the new command so it works out what front matter to create based on given page type.. Example:

new page <-- default front matter vars

new post <-- prob same as above

new product <-- same as above but with price, shipping, paypal_*, etc

new event <-- same as product but with start_date, end_date, location, etc

Namespaces index pages

All index pages should be namespaced by type... Example:

/posts/categories/ 
/products/categories/   
/events/categories/

Users should be able to symlink any index pages/folders they want to the root of their site. So, for example, site.com/categories/ could link to site.com/events/categories/. Users will be able to choose.

Pages of type page shouldn't appear on any index pages.

noname and others added 13 commits October 27, 2019 03:52
- new data: taxonomies.yml

  the authors, categories, tags stuff is now
  defined in this YAML file, so more can be
  added. They also get extra meta info here :)

- new functions:

  In `.app/functions/generate_site_data.sh`

  `get_taxonomies` - return list of taxonomies
  defined in the data (returns the main "key" field)

  `get_taxonomy_items` - returns a list of taxonomies
  ("author", "tags", etc), and makes template data for
  them

  `get_pages_in_taxonomy` - lists the posts/pages in a
  specific category,tag etc.

  In `.app/updates_pages.sh`:

  `rebuild_index_pages` - goes through each taxonomy
  defined, then get each item defined in it, then gets
  each post/page for that item, then generates the
  index pages.

  NOTES:

  These functions will replace the ones in which
  taxonomies are hard-coded to "author", "category"
  and "tags".

  TO DO:

  - remove old stuff, hook in the new functions to `rebuild CLI`

  - create "page types" (steal idea from Hugos "Archetypes"):

    These will give pre-defined front-matter, including unique
    taxonomy selections per type.

  - update `new` command to work with all supported page types:

    Dont hard-code the front-matter choices, get it from the
    "page type" temples (not yet created).
- allow overriding the list of taxonomies to update:
  will make it easier to support `rebuild tags:foo`
  (and other partial rebuild stuff)

- fix `has_date` var, cleaned up (renamed) others.
- always use plural version of taxonomy name in URL
- updated "tag" to "tags" in YAML:
    - matches field in existing front matter
    - all keys match plural (folder) names

..should fix URLs generated for each item in JSON-LD
- removed lots of older functions
- create taxonomy data at end of `generate_site_data.bash`
- updates to `rebuild_index_pages`

As of this commit, index pages are now generated OK
without the help of the pre-existing (now removed)
author/category/tag hard-coded functions.

There is still old stuff to remove and updates to
the `rebuild` command to be done.
```
# rebuild authors:sc0ttj category:markdown,bash
Updating: authors/sc0ttj.html
Updating: categories/markdown.html
Updating: categories/bash.html

Minifying CSS..

Finished.
```

^ the rebuild command now works as before for
building specific index pages - except that it
is the new `rebuild_index_pages` function that
is doing the hard work.

Also removed an un-needed function.
The following commands now work, using taxonomies:

```
.app/update_pages.sh path/to/file.mdsh
```

So, when creating new posts, any taxonomies it has
defined in its front matter will be used to
update the _relevant_ index pages, as before, but
now its not hard-coded to authors/tags, etc.

As of this commit, partial rebuilds should be fully
working again - all using custom taxonomies, no
legacy author/tag/category code used.
@sc0ttj sc0ttj force-pushed the custom-taxonomies branch from 7dbb7e4 to 4b99c31 Compare November 1, 2019 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant