Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2017-02-21 15:32:45

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: bos_author - author url customization...

Zanza wrote #304170:

Wow, I’m not sure this is needed anymore

There is also mta_author_section which is very similar.

I am figuring out how to create a custom author page for each author on the site I am working on.

1) Going with a standard <txp:author escape=”“ link=“1” title=“1” /> works if you just want to reuse your homepage template. I don’t want to do that.

2) This works by manually creating an article in the author section and then linking to it via<txp:bos_author section=“author”/>. Except that you can only use section/title urls. I don’t want to do that, either.

My solution for now: Going with option 1 and setting my default page to this:

<txp:variable name="disposable" value='<txp:rah_function call="strpos" value='<txp:page_url />' search="author" _assign="authorpage" />' />

<txp:if_variable name="authorpage" value="FALSE">
	<txp:output_form form="page-default" />
<txp:else />
	<txp:output_form form="page-author" />
</txp:if_variable>

This works (I have used variations on this trick before) but such a kludgey way to do it. I feel like there has to be a better way but there has never been a demand for it.

Offline

#26 2017-02-21 15:51:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: bos_author - author url customization...

michaelkpate wrote #304174:

Going with a standard <txp:author escape=”“ link=“1” title=“1” /> works if you just want to reuse your homepage template. I don’t want to do that.

What about using the front page as a ‘controller’? I do this sort of thing sometimes in my default Page template:

<txp:if_author>
   <txp:output_form form="landing_author" />
<txp:else />
   <txp:if_category>
      <txp:output_form form="landing_category" />
   <txp:else />
      <txp:if_individual_article>
         <txp:output_form form="head" />
         <body>
            <txp:output_form form="nav" />
            <txp:article />
            <txp:output_form form="foot" />
         </body>
         </html>
      <txp:else />
         <txp:output_form form="landing_article" />
      </txp:if_individual_article>
   </txp:if_category>
</txp:if_author>

Thus, any ‘list’ landing pages are redirected to forms (you can also nest search landing pages in there too if you wish) and any articles use the bit inside the <txp:if_individual_article> tags. That could also be entirely offloaded to a Form if you prefer.

The head, foot and nav Forms are all reused on the various landing_* Forms. The head Form especially has the doctype and opening <html> tag and all the meta data usually found in <head>.

Doing it this way, you can pick and choose which landing pages have similar visual representations and farm off the ones that differ to a dedicated Form, while retaining Txp’s convention of “the default Page is the destination for all listy output” and keeping the Page logic less crazy.

ymmv


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#27 2017-02-21 16:18:22

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: bos_author - author url customization...

Bloke wrote #304175:

What about using the front page as a ‘controller’? I do this sort of thing sometimes in my default Page template:

You know, somewhere along the line last night I became convinced that you couldn’t use if_author for that. Which I knew better.

Mainly, I was focus on making sure the meta information was set correctly but I think I just figured it out.

Still, I wish somebody had figured out a way to implement this idea:

It would perhaps be better if one could redirect the <txp:author /> tag to an arbitrary section that is not the default Page because then this feature goes away. Not sure if that’s possible, though. – Why txp:author links to frontpage only?

Offline

#28 2017-02-21 16:30:49

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: bos_author - author url customization...

michaelkpate wrote #304174:

There is also mta_author_section which is very similar.

I am figuring out how to create a custom author page for each author on the site I am working on.

1) Going with a standard <txp:author escape=”“ link=“1” title=“1” /> works if you just want to reuse your homepage template. I don’t want to do that.

2) This works by manually creating an article in the author section and then linking to it via<txp:bos_author section=“author”/>. Except that you can only use section/title urls. I don’t want to do that, either.

I’m not sure I get it. If you want a page for each author in an “authors” section (the same I wanted when I wrote the plugin), why shouldn’t you want a section/title url? What am I missing?

Offline

#29 2017-02-21 17:19:35

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: bos_author - author url customization...

Zanza wrote #304177:

I’m not sure I get it. If you want a page for each author in an “authors” section (the same I wanted when I wrote the plugin), why shouldn’t you want a section/title url? What am I missing?

I was trying to stick to the Google News inclusion guidelines – which used to encourage a 3-digit serial number. But perhaps it isn’t worth bothering with anymore.

Offline

#30 2017-02-21 17:38:09

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: bos_author - author url customization...

Useful information:

Firstly, don’t make a section called author as that’ll probably break things. But you probably figured that out already :-) – Bloke

Strangely, I hadn’t seen this mentioned anywhere else. I changed author to contributor and that made the 404 go away.

Offline

Board footer

Powered by FluxBB