styxlab / gatsby-theme-try-ghost

A Gatsby theme to build flaring fast blogs from headless Ghost CMS
MIT License
136 stars 56 forks source link

feat: new theme package to show all the tags as a collection #282

Closed sawilde closed 3 years ago

sawilde commented 3 years ago

new theme package to show all the tags as a collection of pages, similar to how posts are displayed in the main page

  1. TagsIcon - currently this is a copy of the twitter icon - advice needed on a good place to source svg icons that won't get this project in any strife due to attribution requirements.
  2. TagsHeader - this is supplied so that people can customise the header ie add a banner image or similar
  3. I used google translate for the translations - probably garbage
  4. Updated SiteNav to host a dummy ShowTags that can be overwritten by the package
  5. TagCard will also show an image for the tag if it is configured in the ghost CMS

I am not keen on how I have hooked in the tags page - I hope there is a better way.

I have been using this code on my own site for about a year and had no issues - only just converted to package though so feedback appreciated as it is probably a little rough for general consumption.

styxlab commented 3 years ago

Hey @sawilde! Thanks so much for this excellent contribution. Please give me a couple of days to review it in detail. It's nice that you made a new packages, so it can be easily switched on/off. One question upfront: Where does the data for TagIcons, TagHeaders, etc. come from? I'd prefer to have this configured in Ghost as much as possible.

sawilde commented 3 years ago

TagIcon - implemented the same way as TwitterIcon (in fact it is just a copy of, as I don't have a good source of free svg icons.) - this needs some tinkering - the alternative is to add it to the menu like the contact plugin - I am not sure there is a place in Ghost to configure this.

TagHeader - currently the data is in a localisation file - which is why I created that piece as a separate component to allow it to be overridden. This is the first pass at turning it into a plugin and it may be possible to pass in the config for the title via the options - again not sure if such a place in Ghost exists for this.

tags.js - currently this is a page (as that is how I currently host it) but looking at the other plugins I think I may need to inject it as a PageNode (similar to contact) but I need to get my head on how that works.

All the other information for the tags (title, image, description, count) comes from the ghost CMS itself - add an image to the tag in your ghost blog that is being used as reference. Add more tags and you get the 1,3,2 pattern and infinite scroll.

sawilde commented 3 years ago

@styxlab - some updates

tags.js is now a template and is being added as a page (pageNode) - title and path pulled in via config - ditched the dodgy language translations (I assume people can now configure this in the config)

TagIcon is gone and I am now using FontAwesome and using the faTags icon (the attribution is in the svg and so good)

Renamed some of the components

sawilde commented 3 years ago

@styxlab added ability control Icon visibility - I haven't added it as a navigation entry yet 2 ways

  1. add tags page to your Ghost Blog that points to /tags/ (this is how I do it the moment)
  2. add something similar to how the contacts plugin appends its entry to the nav
sawilde commented 3 years ago

adding it to the navigation menu (as contact does - or perhaps doesn't) will take time.

I tried disabling the hook for contact by updating the setting as navigation: [] and the contact menu entry remained

styxlab commented 3 years ago
sawilde commented 3 years ago

I think I have done what I needed to for this

styxlab commented 3 years ago

Please be patient with me as I need a couple of days before I can do my final tests, merge and publish.

sawilde commented 3 years ago

no worries - how do you publish the packages once they have merged? Do you have a separate build pipeline?

styxlab commented 3 years ago

Thanks so much @sawilde ❤️!!!

styxlab commented 3 years ago

This package still needs to be published to npm....

styxlab commented 2 years ago

Finally published on npm. Sorry for the delay and thanks again for your contributions!

sawilde commented 2 years ago

thanks and it was a pleasure