Permalinks :: Section

By jenolan - January 30, 2015

As mentioned in another post I am starting to work on stuff again, slowly, slowly .. Have setup a couple of areas to play with and now working on how the SEO (Permalink) structure will work for my planned site. I will explain what I am trying to do before code change requests :-)

I add a 'permalink' field to the section, perfect it will now generate the link, purrfect, but all the links that are created are root level ie http://example.com/permalink now that is not going to work with multiple sections that could cause collisions. In my example the section 'Activities' might have an item 'LOC44 :: The Journey Home' that's a file category, by my blog section will have EXACTLY the same heading for a,well blog, about the new file. So now we can't have the same permalink. What s needed in the section editor, probably in advanced options is the ability to add the permalink prefix for all links from that section. So in the Activities section my prefix would be 'activity' rthen the link would be http://example.com/activity/permalink and my blog could be http://example.com/blog/permalink.

Get the idea?

Now when I looked to add this I notice that there is no way via a hook to add anything to the 'top menu' of the section editor. Quick and dirty I can add a check to see if the permalink plugin is installed (easy) and the add an additional field to the advanced option (again easy) then save the value (not so easy) for use by the permalink plugin. Do you have a preference?

Thanks,
Larry

---



Peace and Long Life

By jenolan - January 30, 2015 - edited: January 31, 2015

In digging through the code I noticed that you have an enforced 'prefix' already, just it was not automatic. Rather than do a lot of hacking what I have changed it to do is that the prefix is automatically added to the url shown on the edit form, and is then added to the record automagically. Patch below attached.

Update: Wrong variable used patch 2 attached

---



Peace and Long Life

By jenolan - February 2, 2015

In the entry area, where you type the permalink instead of "http://mysite/" being displayed, you get "http://mysite/prefix/" (shown on the entry screen) AND it automatically adds the prefix to the link so the user is NOT required to type it every time. Much more friendly, why should the person entering the link need to know to always manually add the prefix? :-)

What I am heading towards with this, is that the prefix could contain a substitution value so that permalinks like a wordpress site can be done, ie the prefix is blog/{%Year%}/{%Month%} and so on, didn't want to mess with that quite yet as I was just making the prefix handler more pleasant.


Larry

---



Peace and Long Life

Given up trying to make this 'patchable' will make my own plugin jPermalink++ by the time I am finished although on the face it might start out looking the same it will be different. FWIW I wanted to be able to integrate CALM & permalink for the redirect processing.

When I am done will do a code compare don't think there will be much, if any, commonality, so I shouldn't be breaching copyright (will start from scratch)

Larry

---



Peace and Long Life

By Dave - February 12, 2015

Hi Larry, 

Ok, sounds cool.

What about if we just supported PHP tags in the "Default Value" field, and could refer to the current record as $RECORD.  Would that let you do the  {%Year%}/{%Month%} bit? Perhaps with some more code.  Or maybe we could just add support for some of those placeholders in that field.

I'm imaging you want to do more than that, but I thought I'd put that out there.

Cheers!

Dave Edis - Senior Developer
interactivetools.com

yeah .. two bitz allowing 'macro' stuff plus resurrecting CALM. I am also looking at a Silex/Twig front end and as usual all sort of other mischief, you know me, always something else to code ;-)

---



Peace and Long Life