Static page navigation

Creating and modifying plugins.
User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Static page navigation

Post by Don Chambers » Thu Oct 11, 2012 5:59 pm

In my humble opinion, static page navigation ... umm... sucks! Maybe we can get some collective ideas on how to improve it. I did a quick example using bulletproof as the template. I created 4 levels of dependent static pages.. Parent, Child, Grandchild, and Great grandchild. Each static page is set to show navigation, and show child pages.

Parent:
Image

1. shows the previous link ("Static Tab") -top link ("Parent static page") and next link ("Child static page") navigation block. The "top" link is useless - it is a link to the current static page I am already on. These others look somewhat related, but the "previous" and "next" links don't always relate to one another... they just happen to be the previous and next static pages in the list of all static pages. I consider this block nearly worthless and usually have it disabled. I noticed that 2k11 does not bother to include the code - even if enabled it will not show.

2 shows the bread crumb. Breadcrumbs are more valuable than the navigation block above, especially when using parent/child/dependent static pages. I don't like this for three reasons: 1) There is no "home" link. 2) The only link for this first level static page is the static page title itself. Why do I need a hyperlink to a page I am already on? I realize the static page headline is also a hyperlink, but I think that may have been done more for visual reasons. 3) There is no way to enable/disable the breadcrumb navigation without enabling or disabling the previous/top/next navigation. Can we get another smarty variable for showing breadcrumbs, like maybe $staticpage_showbreadcrumb ?? I have my own improvement for displaying the breadcrumb, and will show that below.

3. shows child pages. This parent static page only has one child, and that is correctly shown. This would be far more valuable if it also showed nested dependents (ie, grandchildren, great grandchildren....

Child:
Image
1. In the parent static page above, the "top" link showed the static page title, and pointed to the static page url. In this first level child, it uses the text "TOP" and points to the base URL. I have no idea why. Although this is my first level "child", it is possible I created this static page before all others, and when the function is looking for the prior static page, it finds none???

My complaints for 2 & 3 are the same as above.

Grandchild:
Image
1.Here the "top" link isn't this static page's parent, it is the grandparent "Parent Static Page".

Great grandchild:
Image
1.As above, the "top" link isn't this static page's parent, it is the great-grandparent "Parent Static Page".

I find this breadcrumb code to be more useful:

Code: Select all

      <a href="{$serendipityBaseURL}">{$CONST.HOME|lower|capitalize:true}</a>&nbsp;&raquo;
      {foreach name="crumbs" from=$staticpage_navigation.crumbs item="crumb"}
      {if !$smarty.foreach.crumbs.first}&raquo;&nbsp;{/if}{if !$smarty.foreach.crumbs.last}<a href="{$crumb.link}">{$crumb.name|@escape}</a>{else}{$crumb.name|@escape}{/if}
      {/foreach}
Which looks like this:
Image

In summary:
1) I find the previous/top/next navigation to be virtually worthless. It is disabled by default, and perhaps it works for some people. Not sure if I advocate complete removal, but does anyone have suggestions for how to improve it? Instead of a previous/top/next, how about showing a dropdown box of all static pages, much like when selecting a static page in the backend for editing?

2) I would like an option to enable/disable the breadcrumb separate from the prev/top/next navigation. I can probably figure out the code myself or if someone else wants to jump on it first go right ahead.

3) I think my suggested breadcrumb code works better: It adds a "home" link which points to the baseURL, and does not make the current static page title a link. I would like to add this to the plugin's smarty template(s), and I can add it to bulletproof. YL can choose whether to add it to 2k11 as that template does not currently use bread crumb navigation.

4) When showing child pages, would it be possible to also show further nested/"grandchildren" pages?

5) In the previous/top/next navigation box, the "top" link seems to always point to the first level static page. Is this operating as expected? If so, then nothing needs to change.

6) Sorry for the long-winded rant!!! :mrgreen:

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Static page navigation

Post by yellowled » Thu Oct 11, 2012 6:37 pm

Don Chambers wrote:1) I find the previous/top/next navigation to be virtually worthless.
I second that. It is not very intuitive. Worst of all, it tries to relate all static pages in the system to one another, which is just plain wrong. The relationship between static pages is not prev/next, it's parent -> child etc.

Then again, it is my opinion anyway that the static page plugin in it's current form is not cut out for complex hierachies of static pages. This also relates to the static pages sidebar plugin, which would be a good navigational option, but seems to be rarely used. It also doesn't provide the best markup output, but that would be the easiest thing to fix.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page navigation

Post by Don Chambers » Fri Oct 12, 2012 9:10 pm

So I made the changes I discussed above, and was about to commit them, when I see that Ian has committed different changes to the same plugin. Ian didn't change the version number (3.95), but I did (3.96). So, in the github world, what is the appropriate way to merge my work with Ian's latest changes?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Static page navigation

Post by Timbalu » Sat Oct 13, 2012 9:15 am

Hi Don

I just added some tweaks to staticpages based on a discussion I had with Garvin, where he took the initiative to work-in the preview, and named it 3.95. I just added some others later, before the overnight sync was done. That is why I could stick to the version number Garvin already changed to.

But as I already noticed this morning I missed some essential code part to put, so I will hurry up to add this and name it 3.96, then you can follow and just put in your changes too. The overnight sync normally happens around 4am MEZ in the morning.

If you already changed your local repro and got stuck with these changes happened yesterday, you get this message: "Please, commit your changes or stash them before you can merge."
That means:

Code: Select all

$ git add .
$ git stash
$ git pull origin master
Howto merge-in your stashed changes later, I dont know yet, sorry.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page navigation

Post by Don Chambers » Sat Oct 13, 2012 4:52 pm

The files I revised were prior to your modifications yesterday. I have not yet attempted to commit them. Are you saying that when I do commit, I will receive some kind of message advising me to merge the changes with yours?

I see that one of the things you are adding is custom meta details, as I discussed in this blog entry. The method I discussed required modifying a template's index.tpl to emit these custom meta fields. If you are only modifying the static page plugin, how will you get that info to a specific template?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Static page navigation

Post by Timbalu » Sat Oct 13, 2012 6:33 pm

to 1st.: No, if you haven't changed your local repo yet, yes on the other hand.
What you need is to pull first, then change, then push.

to 2cd.: I don't really remember where I took that from.... in early days. It might as well has been your blog entry. I lived with it for a while and never had problems. Your question now reminds me that I have this code part in my templates index, which does not seem to be the standard... How bad! Hmmm, I totally forgot about it...!

Code: Select all

<head>
    <meta charset="{$head_charset}">

    {* Use the .htaccess and remove these lines to avoid edge case issues. More info: h5bp.com/b/378 *}
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

{if $staticpage_custom.title_element}
    <title>{$staticpage_custom.title_element|escape:htmlall}</title>
{else}
    <title>{$head_title|@default:$blogTitle}{if $head_subtitle} - {$head_subtitle}{/if}</title>
{/if}

    <meta name="Powered-By" content="Serendipity v.{$head_version}">
    {* Mobile viewport optimized: h5bp.com/viewport *}
    <meta name="viewport" content="width=device-width">
{if $startpage}
    <meta name="description" content="{* YOUR DESCRIPTION FOR THE STARTPAGE *}"> 
    <meta name="keywords" content="{* YOUR KEYWORDS FOR THE STARTPAGE *}"> 
    <meta name="author" content="{* YOUR AUTHOR DESC FOR THE STARTPAGE *}">
{/if}
{if $staticpage_custom.meta_description}
    <meta name="description" content="{$staticpage_custom.meta_description|escape:htmlall}">
{/if}
{if $staticpage_custom.meta_keywords}
    <meta name="keywords" content="{$staticpage_custom.meta_keywords|escape:htmlall}">
{/if}

.... all the resting header parts....

</head>
Now, we have to inform the staticpage author to use some kind of these, if supporting staticpage metatags. Thanks for looking up!

Any ideas how to do best? (We could simply just post a warning and noting link to this thread into staticpage config meta desc text...)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page navigation

Post by Don Chambers » Sat Oct 13, 2012 7:09 pm

I'm merging the changes now... so don't commit anything again until I'm done! :mrgreen:

Yeah, that was from a blog entry of mine 3 years ago, but does require a modification to index.tpl. I cannot think of an easy way to do it other than perhaps a note on the static page. I'll think about it for a bit.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Static page navigation

Post by Timbalu » Sat Oct 13, 2012 7:54 pm

Yepp, please go on.
In the meantime I am running a few tests with a tooltip note and a link.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page navigation

Post by Don Chambers » Sat Oct 13, 2012 9:12 pm

I committed my breadcrumb modifications to both the static page plugin, and the bulletproof template.

So I was thinking about these custom <title>, <meta description>, and <meta keywords>. In most template's index.tpl files, <title> is the only thing being emitted - meta keywords and description are not part of any of our bundled templates that I know of. The <title> code usually looks like this:

Code: Select all

<title>{$head_title|@default:$blogTitle}{if $head_subtitle} - {$head_subtitle}{/if}</title>
The HTML META-tags plugin shows how we can manipulate $head_title to actually be anything we want, so we get <title>Anything We Want</title> with the standard index.tpl <title> code.

So what I'm thinking is instead of using custom static page fields, what if they were specifically named fields just like headline, content, etc.... and if that item is not blank for a specific static page, you use the frontend_header hook to modify $head_title and also emit <meta description> and <meta keywords> in the <head> ??

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Static page navigation

Post by Timbalu » Sat Oct 13, 2012 9:30 pm

Its too late for me .... now. :roll:
To have at least a working plugin by tomorrow, I commited a tooltip note and link to this thread and set the use of META block to false by default now.
Maybe Garvin will find a better way for that all...
Good night!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page navigation

Post by Don Chambers » Sun Oct 14, 2012 4:22 pm

Question.... in the backend configuration for the plugin, you added the option of "Include HTML meta input fields". what impact does this have?

Also, at around line 2496, you added "showmeta" to this:

Code: Select all

            $serendipity['smarty']->assign(
                array(
                    'showmeta'       => serendipity_db_bool($this->get_config('showmeta')),
                    'form_keys'      => $form_values,
                    'form_container' => $this->staticpage,
                    'form_post'      => $serendipity['POST']['plugin'],
                    'form_values'    => (is_array($serendipity['POST']['plugin']) ? $serendipity['POST']['plugin'] : $this->staticpage)

                )
            );
Why is that necessary or how is it used?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Static page navigation

Post by Timbalu » Sun Oct 14, 2012 4:45 pm

Well, in staticpages config you can decide whether to use HTML META tags as an option (no/yes)
The smarty assigned Variable offers the result, to show the meta input fields or not via default_staticpage_backend.tpl (showing the staticpage entry form). Anything wrong with that?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page navigation

Post by Don Chambers » Sun Oct 14, 2012 6:13 pm

I have set that choice to both yes and no. The meta fields are shown on default_staticpage_backend.tpl regardless of the setting. Shouldn't the all the code for meta fields be wrapped in {if $showmeta}...{/if}?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Static page navigation

Post by Timbalu » Sun Oct 14, 2012 6:20 pm

Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Static page navigation

Post by Don Chambers » Sun Oct 14, 2012 7:44 pm

It wasn't in my copy. That's odd. My repo missed that final commit. Sorry for the confusion!

Post Reply