Alpina Posted Wednesday at 01:27 AM Share Posted Wednesday at 01:27 AM (edited) Hi, My blog structure. The question is, how do I have the posts showing up before the categories and tags? Like below: Blog -> template blog-index Post 1 -> template blog-post Post 2 Post 3 ... Categories -> template blog-cat-index Category 1 -> template blog-category Category 2 Category 3 ... Tags -> template blog-tag-index Tag 1 -> template blog-tag Tag 2 Tag 3 ... Cheers Edited 20 hours ago by Alpina Solved Link to comment Share on other sites More sharing options...
AndZyk Posted Wednesday at 10:04 AM Share Posted Wednesday at 10:04 AM (edited) Hello @Alpina, if your template blog-post has a date field and the other templates (blog-cat-index and blog-tag-index) not, you could sort the children of your template-blog-index by that date field. Then the blog posts should be always before the categories and tags. You can sort them in the template settings of your blog-index template under the family tab. That is how I like to do it. You could also use a system date fields like created or modified, but then the categories and tags could get mixed in the sort order. Regards, Andreas Edited Wednesday at 10:04 AM by AndZyk 1 Link to comment Share on other sites More sharing options...
virtualgadjo Posted Wednesday at 10:05 AM Share Posted Wednesday at 10:05 AM hi, well, first i must say for many reasons (seo, menu building, sitemap and so on) i wouldn't structure e blog this way, instead i would put the two parents (categories and tags) outside the main blog parent page and then use them with page reference and url segments but well... now if you want to easily cheat, blog posts are usually ordered by reverse chronological order, then guess, add your date field to the, categories and tags parent pages and set them with a last century date 😄 job done, those two parent pages children can still be ordered the way you want have a nice day just modified to say @AndZyk was faster to have the same king of idea while i was writing 🙂 3 Link to comment Share on other sites More sharing options...
Alpina Posted Wednesday at 11:10 AM Author Share Posted Wednesday at 11:10 AM (edited) Thanks @AndZykI will try that. @virtualgadjoI'm interested to learn more about your approach. Could you elaborate on it a bit more? Edited Wednesday at 11:39 AM by Alpina 1 Link to comment Share on other sites More sharing options...
virtualgadjo Posted Friday at 04:15 PM Share Posted Friday at 04:15 PM Hi, sorry to be so late to answer, hit week... 🙂 actually it's quite simple, i would use your folder but this way Blog -> template blog-index Post 1 -> template blog-post Post 2 Post 3 Categories -> template blog-cat-index Category 1 -> template blog-category Category 2 Category 3 ... Tags -> template blog-tag-index Tag 1 -> template blog-tag Tag 2 Tag 3 ... then in your blog post template i would add two page-reference fields, one for the categories (parent => categories) and on for the tags (parent = well, guess :)) this way each post can easlily belong to various categories and have as many tags as you need afterwards, for your main blog index template allowing page numbers and url segments it's easy to add a selection of the posts based on the categories and/or the tags with,, in both cases, the ability to have a pagination as well as for the main list of posts depending on the way you want to filter your posts you'll just have to check the url segemnts, if only one (pagination or not, you can check if it is a category or a tag, if two either you decide the order (category/tag) or just check what kind is each one (easy to do making arrays of the available categories and tags to check in which one is which segment) something more, this way, each post will just have only one url yoursite.com/blog/thepostname no matter from which selection you're coming avoiding many potential isszues with duplicate content, categories and tags being only a way to select which posts are displayed on your page hope it's a little more explicit 🙂 have a nice day 2 Link to comment Share on other sites More sharing options...
Alpina Posted 20 hours ago Author Share Posted 20 hours ago It's all clear now. Thank you! Link to comment Share on other sites More sharing options...
AndZyk Posted 17 hours ago Share Posted 17 hours ago (edited) @virtualgadjo Maybe I am missing something, but your structure and the first structure achieve exactly the same result. The only difference is your structure uses one template (blog-index) with URL segments and the other one would use three templates (blog-index, blog-cat-index and blog-tag-index) and no URL segments. I used the first structure (all inside blog with two page reference fields) many times with no downsides. So what I want to say: It is just a matter of preference. ✌️ Edited 17 hours ago by AndZyk Link to comment Share on other sites More sharing options...
Alpina Posted 8 hours ago Author Share Posted 8 hours ago Hi @AndZyk, I may be wrong, but the main difference between my structure and @virtualgadjo is that categories and tags are children of /blog in my case, which is not in virtualgadjo's case. Am I missing something? Link to comment Share on other sites More sharing options...
virtualgadjo Posted 3 hours ago Share Posted 3 hours ago hI, maybe i should explain a litte more 🙂 in the structure i use, blog posts are indeed children of the main blog page (and template, i'll go back to this later) and categories an tags are just a way to select which posts you want to display depending on url segments the important thing to me is that, whatever "list" you're coming from, domain/blog/ domain/blog/tag_n/ domain/blog/cat_n/tag_,n/ and so on, when you click o a post its url will alwasys be domain/blog/post_n, no duplicate content, url segments making easy to use back to the list link, bookmark (and are prettier than js url hash but those could be used too) now if you're sure (iron sure changing your mind would be painful to restructure), the posts will only belong to one category, @AndZyk's structure is a the best solution keeping only the tags outside the blog "folder" --- Blog -> template blog-index Category 1 -> template blog-category Post 1 -> template blog-post Post 2 Post 3 Category 2 Post 4 Post 5 Post 6 Category 3 Post 7 Post 8 Post 9 ... Tags -> template blog-tag-index Tag 1 -> template blog-tag Tag 2 Tag 3 ... @Alpina, well yes and no 😄 first of all think of the blog with 50 say 100 posts, coming into the admin to add a category or a tag, i don(t know why but i think you would be happy to find those "folders" outside the main blog one instead of having to look for it under a tide of posts, less clicks, best life :) and as pw makes my life (and my clients' one) so easy, i try to keep it this way 🙂 the other thing, and in this case i'm always thinking i'm making the website for somebody else, friend, or client and not for me..,. i'm a huge fan of the children tab features which template is allowed for parent/children, in this case, when my victime clicks on the new button of the blog parent the created child has a blog_post template without having to choose (and make potential mistakes) well you could say that setteing the category and the tag parent templates on can't be used for new pages it would work too but think about the previous point i spoke about i have maybe a strange habit but making a websit i always think - as if it is not for me (well that's mainly the case 🙂 ) - think of it not as it is just when i'm making it but a few months or years after being used, sort of a reality principle and when thnking about a structure, i'm under a storm of "what if...?" (and so are my victims :D ) there must be no exceptions, each exception becoming a rule, it makes things a liitle longer to decide but so more confotable to use afterwards... well i think i should call it a post :D have a nice day Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now