danurbanowicz / eleventy-netlify-boilerplate

A template for building a blog with the Eleventy static site generator and Decap CMS
https://eleventy-netlify-boilerplate.netlify.app/
MIT License
528 stars 183 forks source link

Can't get tags and author to work on another repo #68

Closed talmax1124 closed 2 years ago

talmax1124 commented 3 years ago

Hello, I cannot add the tags or author feature to this repository. Could someone help me and do a pull request? I also have a question on regards the layout template, I have it configured a different way, can someone help me configure everything to match my repo: https://github.com/talmax1124/DrKhan

danurbanowicz commented 3 years ago

Your issue with authors is probably due to incorrect naming in your project. For example in your eleventy.js where the authors collection is generated from a glob, you are referencing a folder that no longer exists:

 eleventyConfig.addCollection("authors", (collection) => {
    const blogs = collection.getFilteredByGlob("posts/*.md");

If you change the posts/ folder to articles/ then the collection should be generated correctly.

Check your project for any other small inconsistencies like that, and then everything should work.

Let us know if you need any more help. And post any errors here so that we can see what's going on in your build.

Thanks!

talmax1124 commented 3 years ago

@danurbanowicz It is not working at all. & I'm not recieving any errors at all at runtime. This time I tried it on another repo, but it is not giving me right result, instead giving me this screen when clicking on author.

Screen Shot 2021-09-16 at 6 47 55 PM

Repo: https://github.com/talmax1124/knighttimesnews-restore

danurbanowicz commented 2 years ago

From your code it looks like you are mixing this project with another similar starter project, maybe that is where the problems are originating?

The GET error above likely points to a problem with your permalink setup in your frontmatter. i.e. the pages are being output somewhere different. The first step is to check your output directory and see what it is actually outputting there.

talmax1124 commented 2 years ago

@danurbanowicz I am using the https://github.com/kevin-powell/new-website repository

talmax1124 commented 2 years ago

I think that maybe the issue is that there is no authors folder. I don't know how your repo is generating the authors. I just have my authors in the frontmatter when making a post. @danurbanowicz

danurbanowicz commented 2 years ago

An authors folder is not required.

The authors collection is added in eleventy.js using eleventyConfig.addCollection

It looks for the author inside each post's frontmatter and uses author.njk to paginate the collection and generate a page of posts for each author.

Hopefully this helps!

danurbanowicz commented 2 years ago

I'm closing this issue for now but do let me know if you need me to re-open and investigate this further. Thanks!