anchorcms / anchor-cms

A lightweight blog CMS for PHP
http://anchorcms.com/
GNU General Public License v3.0
3.32k stars 575 forks source link

Child Page's link goes to 404 #523

Closed miragecraft closed 8 years ago

miragecraft commented 10 years ago

I'm trying out anchor and ran into an issue.

I created a child page called "Test Page" under the default "Posts" page.

So the link in the menu on the default theme points to the url "my_site/posts/test-page".

However that link goes 404, and the actual, accessible url is at "my_site/test-page".

Obviously something's wrong here.

Here's my test setup: http://www.miragecraft.com/test/anchor/

SuperSpyTX commented 10 years ago

I believe the links are slightly incorrect on different pages.

http://www.miragecraft.com/test/anchor/page/test-page is correct link while http://www.miragecraft.com/test/anchor/posts/test-page is not.

Interesting bug.

robsterlini commented 10 years ago

This is a problem I'm still having. It seems SuperSpyTX is correct in saying that pages assigned as children to the 'posts' page will be treated as full pages rather than as the child.

CraigChilds94 commented 10 years ago

I'll take a look at this now. It's an unusual case as ideally you wouldn't need a child page of the posts page due to the capabilities of it.

CraigChilds94 commented 10 years ago

@rbs-fueled can I just ask why you might want to have a child page of posts?

robsterlini commented 10 years ago

@CraigChilds94 My use case was to create an /journal/archive as a child of /journal (see http://robsterlini.co.uk/journal and http://robsterlini.co.uk/archive), although I'm sure there are other similar reasons out there that one might want to attach child pages to their posts page.

systimotic commented 10 years ago

@rbs-fueled You could still do that with categories, right? And use The Loop? Shouldn't be to hard with a little PHP knowledge. Your site looks great by the way!

robsterlini commented 10 years ago

@TimohStudios Yeah, my site is a bit ambiguous in that sense. Archive (in its new use) is a list of all of the posts (my journal page only shows the latest 5 or 6), whereas the category archive is for old posts from old blogs (that should probably be renamed). The problem isn’t that I can’t create the page (http://robsterlini.co.uk/archive is using custom PHP to serve the list on the non-posts page), the problem is that even though /archive is assigned to /journal it’s not accessible from /journal/archive.

Thanks, although it’s not quite finished yet, it’s in a bit of an accidental-pre-shipped-beta phase at the moment.

EDIT: I’ve just realised my previous comment refers to /archives and not /archive. Apologies, I fear that, that may have caused some confusion! =)

systimotic commented 10 years ago

Now I see! I thought you still had to create the archive page, because the link led to a 404.

Well, reason it does that is because all articles are children of the posts page. There are some options though. What I think would work best in your case is make it an article with a custom template. Only problem is that it would show up in Journal and in itself, but you can work around that too. You could also make your journal just use The Loop to display the last 5 articles, and make archive it's child and the posts page. Let me know what you can think of or use.

Edit: The second one might be better, now that I think of it. I hadn't thought that through fully when I wrote "What I think works best in your case".

robsterlini commented 10 years ago

@TimohStudios They both seem a tad hacky. I understand now that the children of the /journal page are all going to be top level / rather than /journal/ which makes sense.

The problem with the second suggestion is that it wouldn’t handle the categories, would it?

systimotic commented 10 years ago

Yes, it's a bit hacky, but that's what you're gonna have to do if you want it that way, and it's only theme side, so you aren't messing with the core. What categories would it need to handle? I'm not sure if it can, and I can't seem to find The Loop again. I really like my second solution, and it really isn't that hacky, and the url's will still look nice. Also, while I'm at it, I'd like to point out two invalid links on your site.

  1. The "Find out more about me" button on your home page links to "about" instead of "about-me". 2014-09-23 17_49_39-home freelance web designer front-end developer hi i m rob sterlini
  2. In your CV, the St. George's JCR part, the links that should be 2011 and 2012 archives both link to 2011. 2014-09-23 17_49_12-my curriculum vitae freelance web designer front-end developer hi i m rob

I can make a draft of my idea, if you don't fully understand what I mean yet.

systimotic commented 10 years ago

@rbs-fueled Any news on this?

robsterlini commented 10 years ago

@TimohStudios haven't had too much of a chance to play around with it yet. Hoping to get some time later this week to have another look at it. Although I was looking today and realised that /categories doesn't sit under the /journal pages either, so wondering if it's actually that much of a big deal.

systimotic commented 10 years ago

@rbs-fueled I see. Easy fixed could be done using The Loop (I finally found the link!) and making the posts page (archive) the child of the journal (where you'd use the loop)

robsterlini commented 10 years ago

@TimohStudios yeah, that's similar to what I'm using to create the archive page currently. Just means rejigging the pages and I can’t really be bothered haha ;)

systimotic commented 10 years ago

@rbs-fueled Haha, I understand :smile: Anyways, good luck. I just read you're latest article, looks like your having a good time at Fueled (I'm actually going to London in a couple of weeks, is there anything I don't want to miss?).

CraigChilds94 commented 8 years ago

I've finally fixed this.