Page Title Management

    Table of contents
    1. 1. Introduction
      1. 1.1. Intended Audience
        1. 1.1.1. Verbage
        2. 1.1.2. On the separation of title and path
      2. 1.2. Related
      3. 1.3. References
    2. 2. Status
    3. 3. Functional Specification
      1. 3.1. Use Cases
        1. 3.1.1. Create a new page and set its title
        2. 3.1.2. Update a page's display title and update the URI title automatically
        3. 3.1.3. Update a page's display title and URI title independently
        4. 3.1.4. Move a page in the hierarchy
      2. 3.2. Non-goals
    4. 4. Technical Specification
      1. 4.1. UI requirements
      2. 4.2. Concept of 'linked'
            1. 4.2.1.1.1. Becoming linked
            2. 4.2.1.1.2. Breaking the link
            3. 4.2.1.1.3. When linked matters
      3. 4.3. API requirements
        1. 4.3.1. Database schema change
          1. 4.3.1.1. Update Script
        2. 4.3.2. Page Info XML changes: pages/{id}/info
        3. 4.3.3. POST: pages/{id}/contents changes
        4. 4.3.4.  
        5. 4.3.5. POST:pages/{id}/move changes
          1. 4.3.5.1. Query Parameters
          2. 4.3.5.2. Query Parameter Behavior
            1. 4.3.5.2.1. When are the page title & name linked?
            2. 4.3.5.2.2. Behavior Overview
        6. 4.3.6. Testing Summary
          1. 4.3.6.1. 'to' Parameter
            1. 4.3.6.1.1. Case 0a - to=path, page is linked
            2. 4.3.6.1.2. Case 0b - to=path, page is unlinked
            3. 4.3.6.1.3. Case 1a - to & name/parentid
            4. 4.3.6.1.4. Case 1b - to=path, title=string
          2. 4.3.6.2. 1 Parameter
            1. 4.3.6.2.1. Case 2 - name=path
            2. 4.3.6.2.2. Case 3 - parentid=pageid
            3. 4.3.6.2.3. Case 4 - title=string
          3. 4.3.6.3. 2 Parameters
            1. 4.3.6.3.1. Case 5 - name=path, parentid=pageid
            2. 4.3.6.3.2. Case 6 - name=path, title=string
            3. 4.3.6.3.3. Case 7 - parentid=pageid, title=string
          4. 4.3.6.4. 3 Parameters
            1. 4.3.6.4.1. Case 8 - name=path, parentid=pageid, title=string
            2. 4.3.6.4.2. Case 9 - Empty parameters
        7. 4.3.7. Extra Test Cases

    Introduction

    The goal of this feature is to remove confusion between a page "move" and a change to the page "title".  Some versions back, these two were separated, leaving the possibility of having the page title different from the URI.  While this allows for controlling the order that pages appear in the nav bar, it also creates (in my experience) significant user confusion.  It has also caused scripted templates to break, when the scripts don't adequately account for the various cases when title != name.

    Intended Audience

    This feature is intended for content authors in MindTouch, and this work will be available to all versions starting with Olympic.

    Verbage

    For the sake of clarify, some basic verbage will be defined:

    • Page permalink  is the full URL of the page
    • Display title is the name of the page, as it is displayed to the end-user any time that page is shown
    • URL title is the page's title component of the permalink (it excludes the path that leads up to it, and the page title may be encoded)

    Currently, upon page creation, the display title and the URL title are both set based on the title from the editor. On edits of pages, the editor title becomes the way to edit the display title while the move dialog becomes the mechanism to edit the page title. Clearing out the display title and re-synchronizing the two requires deleting the title form the editor.

    On the separation of title and path

    (See related talk page.)

    To begin with, we need answer a few essential questions: Why do we need separation of title and path?  What function does it provide?

    1. The URL title produced by encoding the display title is either too long or aesthetically unpleasing (e.g. /%2525Title or /index.php?title=some:title).  Therefore there is the need to shorten it or provide a more pleasant alternative.
    2. The URL title replaces spaces with underscores, whereas the display title preserves underscores and spaces.  Also, the URL title may not be a legal page path (such as ./)
    3. The URL title is changed to affect ordering of the page in the hierarchy. 

    (Note that case #3 will go by the wayside with a page ordering solution that is independent of the page path.  Therefore, case #3 should not play a defining role in our analysis.)

    Status

    Scoping by neilw, RoyK. To be a part of the Olympic release.

    Functional Specification

    Use Cases

    Create a new page and set its title

    When a user creates a new page, the user sets a title, which is utilized for both the display as well as the URI title.

    Update a page's display title and update the URI title automatically

    This is the most common use case. A contributor wishes to update a page's title to reflect more accurately the content of a page. The contributor conceptually understands display titles and URI titles are linked, and wishes to make a change to both. The contributor will go to edit the title, then save the changes - the path of least resistance in this workflow should end up with both of them changed.

    Choosing the option of keeping the page title in sync will cause all sub-pages to move as well. (Being a move operation, this feature should be less discoverable.)

    Update a page's display title and URI title independently

    This operation is less common. Here, the user wishes the page title to be different from the URI with the express purpose of controlling the order of the pages in the nav bar, or for creating a simpler URL structure. This use case will also be triggered if a user is attempting to create a page with an underscore (not common); currently due to the way front-end titles are handled, the underscore will be converted into a space.

    In order to do this, the user will go to the same title editing experience, but will conceptually "unlink" the page display title and URI title so edit them independently and save.

    Validation occurs on the URI title to prevent restricted URI characters as well as conflicting title names. Display titles will never throw an error (except in the case an empty string is set).

    Move a page in the hierarchy

    This operation moves the page outside of the existing hierarchy to a new location. This operation should not allow for a display title or URL title change. (This is not a common operation - in most OSes, moving files and changing the file names are different operations).

    The move dialog should only allow for the page's parent path to be set.

    Non-goals

    • This feature will not optimize for the page ordering use case. This is a separate issue and one that should not attempted to be solved using our "move page" dialog.

    Technical Specification

    UI requirements

    The default title view as it is today. title_view.png
    Hovering over the title indicates an editable field. title_hover.png

    Clicking dynamically loads the edit experience.

    Iconography indicates that the display title as well as the URL title are "linked" - updating the title will also update the URL.

    title_edit.png
    Clicking the linked icon exposes a field to set the the URL title of the page. For truncation's sake, if parents or children exist, they will be truncated to ellipsis. title_edit_unlinked.png

    Error states for both the linked/unlinked views.

    Note that in the unlinked view, the field that the error state triggers is highlighted. In the case of the unlinked, since there's only one input, no focus needs to be made.

    title_edit_linked_error.png

    title_edit_unlinked_error.png

    Concept of 'linked'

    A page has a linked URI title and page title upon creation. When linked, the UI allows one field for changing both the URI title and the page title. The user may choose to unlink the URI title and page title and is given separate fields to do so.

    Becoming linked
    • A page is linked upon UI page creation.
    • A page is linked when the URI title can be generated from the display title.
    Breaking the link
    • A page is unlinked only when the URI title cannot be generated from the display title
    When linked matters

    In the case of using ONLY the "to" parameter, the linked state of the page determines the URI title:

    • If the page is linked prior to the move, the final segment given in the "to" parameter is generated from the display title
    • If the page is unlinked prior to the move, no change is made to the path given in the "to" parameter

    API requirements

    Database schema change

    Table Column Type Values
     pages  page_name_type  TINYINT(1)  0 = Default (Linked)
     1 = Fixed (Page cannot be moved)
     2 = Custom (Unlinked)
    Update Script

    Goals: The update script will add the linked column and populate the display title and linked column with data.

    Page Info XML changes: pages/{id}/info

    • New attribute on the path node: type="custom|fixed"
    • When the page name is not generated from the title, then type="custom"
    • For page names which do not allow for UI move ops (root-level homepage, in the future user:, template: and special:), type="fixed"
    • For pages which do not have custom names, the attribute is omitted
    <page id="22" href="http://www/@api/deki/pages/22?redirects=0">
        <uri.ui>http://www/</uri.ui>
        <title>MindTouch Page</title>
        <path type="custom">Foo/Bar/Baz</path
        <namespace>main</namespace>
    </page>

    POST: pages/{id}/contents changes

    Title handling on the contents API needs to be changed. Display titles can no longer be "reset" and thus the preservetitle parameter becomes worthless. Additionally, in the absence of the title parameter, no change to the display title should occur.

     

    Name Type Old functionality New functionality
    preservetitle bool? keep existing display title (default: false) NOOP
    title string? the display title (default: determine title from page path) set the display title (default: NOOP)

     

    POST:pages/{id}/move changes

    Query Parameters
    Name Type Description
    authenticate bool? Force authentication for request (default: false)
    redirects int? If zero, do not follow page redirects.
    to string? new page path (absolute)
    parentid int? integer page ID of new parent page
    title string? new page title*
    name string? new page path segment**
    Query Parameter Behavior

    Below is the expected behavior of the new query parameters for the move API. Each parameter has the expected final naming and functionality detailed below.

    Name Behavior
     to affects only path/name but not title. if page is linked, final segment overriden by display title. if page is unlinked, path unchanged
     parentId  if omitted, current page parent is used
     title  if omitted, current page title is used
     name  if omitted, derived from current page title
    When are the page title & name linked?
     Title  Name  Status
     foo  (omitted)  Linked
     (omitted)  foo [existing title != foo]  Custom
     (omitted)  foo [existing title == foo]  Linked
     foo  foo  Linked
     foo  bar  Custom

    Note: "to" is not included here because the final path is dependent on the linked state of the page. All special cases will be illustrated below.

    Behavior Overview
     

    to

    parentId

    title

    name

     Expected Result
    1 x        Page (final segment in URI parameter) moved to absolute path given in 'to' query parameter. Title is unaffected. 
    2 x x      Bad Request
    3 x   x    Page moved to absolute path and title is set. The last segment in the path is set to the value of title. The title is king. ALL HAIL THE DISPLAY TITLE!
    4 x     x  Bad Request
               
        (empty)      Bad Request
          (empty)    Bad Request
            (empty)  Bad Request
    5   pageId      Page moved to different parent. Title & name unaffected.
    6   pageId?   segment  Valid name required**; path/@type: custom (unless segment == existing title -> linked)
    7   pageId? string    Valid display title required*; path/@type: linked
    8   pageId? string segment  Set a display title* & path segment**; path/@type: custom (unless segment == title -> linked)

    *Display title handling

    • Must contain at least 1 non-whitespace character
    • Always trimmed for leading/trailing whitespace

    **Name handling

    • Must be a valid segment name with the exception of double slashes
    • No leading/trailing double slashes
    • All slashes must be double slashes
    • No leading/trailing underscores or pluses

    ***Title to name conversion

    • Trim invalid leading and trailing characters
      • white space, slashes, underscores
    • Replace spaces with underscores
    • URL encode

    Testing Summary

    The following is a list of cases illustrating the actual and desired behaviors of combinations and inputs of the new and existing move query parameters. Note that in the provided examples encodings are not used for readability. Paths and parameter values are enclosed in curly brackets {}.
     

    Case Parameter(s)  Result
    0a to=path (linked) Page (final segment in URI parameter) moved to absolute path given in 'to' query parameter.
    If the page is linked prior to the move request, URI title in the 'to' path overwrites the display title.
    0b to=path (unlinked) Page (final segment in URI parameter) moved to absolute path given in 'to' query parameter.
    If the page is unlinked prior to the move request, display title remains unchanged.
    1a to=path +
    name=path,
    parentid=pageid,
     
    Combination of name/parentid parameters with 'to' returns Bad Request
    1b to=path,
    title=string
    Page moved to absolute path given in 'to' query parameter and title is set to value given in the 'title' query parameter. The URI title is assigned the 'title' value as well and forces the page to a "linked" state.
    2 name=path URI title assigned value given in 'name' query parameter
    3 parentid=pageid Page moved to child of 'pageid'
    4 title=string Page title is assigned the 'title' value. URI title is assigned the 'title' value as well and forces the page to a "linked" state.
    5 name=path, parentid=pageid URI title assigned value given in 'name' query parameter and moved to child of 'pageid'. Display title remains unchanged.
    6 name=path, title=string URI title assigned value given in 'name' query parameter, and the display title is assigned the 'title' value
    7 parentid=pageid, title=string Page moved to child of 'pageid' and title is assigned the 'title' value. URI title is assigned the 'title' value as well and forces the page to a "linked" state.
    8 name=path, parentid=pageid, title=string Page renamed to path given in 'name' query parameter, page moved to child of 'pageid', and page title is assigned the 'title' value
    9 name=,  parentid=, title= Empty parameters return Bad Request
    'to' Parameter
    Case 0a - to=path, page is linked

    The 'to' parameter takes in a path as input. The new page path is absolute, i.e. relative to root.

    The URI title overwrites the display title.

    Old location: /foo/bar/123 -- Title: 123 -- (linked)
    POST:pages/={foo/bar/123}/move?to={oof/rab/321}
    New location: /oof/rab/321 -- Title: 321 -- (linked)
    
    Case 0b - to=path, page is unlinked

    The 'to' parameter takes in a path as input. The new page path is absolute, i.e. relative to root.

    No change is made to the display title.

    Old location: /foo/bar/123 -- Title: snafu -- (unlinked)
    POST:pages/={foo/bar/123}/move?to={oof/rab/321}
    New location: /oof/rab/321 -- Title: snafu -- (unlinked)
    Case 1a - to & name/parentid

    'to' cannot be used with the name/parentid parameters. Results in Bad Request.

    Case 1b - to=path, title=string

    The page is moved to the path given in 'to'. The title is set to the 'title' value.

    If the URI title == display title, the page is linked. Otherwise it is unlinked

    Old location: /foo/bar/123 -- Title: abcd
    POST:pages/={foo/bar/123}/move?to={oof/rab/321}&title=efgh
    New location: /oof/rab/321 -- Title: efgh -- (unlinked)
    Old location: /foo/bar/123 -- Title: abcd
    POST:pages/={foo/bar/123}/move?to={oof/rab/321}&title=321
    New location: /oof/rab/321 -- Title: 321 -- (linked)
    1 Parameter
    Case 2 - name=path

    The 'name' parameter takes in a string value. The new page path is relative to the final segment in the path.

    Passing a name different than the existing title will result in the page being in an "unlinked" state. Otherwise, it is "linked".

    Old location: /foo/bar/123 -- Title: 123 -- (linked)
    POST:pages/={foo/bar/123}/move?name=new
    New location: /foo/bar/new -- Title: 123 -- (unlinked)
    
    Old location: /foo/bar/new -- Title: 123 -- (unlinked)
    POST:pages/={foo/bar/123}/move?name=123
    New location: /foo/bar/123 -- Title: 123 -- (linked)
    Case 3 - parentid=pageid

    The 'parentid' parameter takes in an integer page ID as input. The moved page becomes a child of the page with the specified ID.

    Old Location 1: /foo/bar/123 (page ID = 456)
    Old Location 2: /oof/rab/321 (page ID = 789)
    POST:pages/={foo/bar/123}/move?parentid=789
    New Location 1: /foo/bar
    New Location 2: /oof/rab/321/123
    
    Case 4 - title=string

    The 'title' parameter takes in a string as input. The page title is set to the 'title' value and the URI title is reset to the title value given.

    Passing only a title forces the page into a "linked" state.

    Old: /foo/bar/123 -- Title: Hello, World! -- (unlinked)
    POST:pages/={foo/bar/123}/move?title={Goodbye, Cruel World!}
    New: /foo/bar/{Goodbye, Cruel World!} -- Title: Goodbye, Cruel World! -- (linked)
    
    2 Parameters
    Case 5 - name=path, parentid=pageid

    Moves the final segment of the old path to the path given in the name parameter as a child of the page given in the parentpageid parameter.

    Passing a name different than the existing title will result in the page being in an "unlinked" state. Otherwise, it is "linked". See case 2 above.

    Old Location 1: /foo/bar/123 Title: Blah
    Old Location 2: /xxx (page ID = 777)
    POST:pages/={foo/bar/123}/move?name=baz&parentid=777
    New Location 1: /foo/bar
    New Location 2: /xxx/baz Title: Blah
    
    Case 6 - name=path, title=string

    Renames the final segment of the old path to the name given in the 'name' parameter and the title is changed to that in the 'title'.

    If name == title, the page's state will be set to linked. Otherwise it will be unlinked. See case 2 above.

    Old Location: /foo/bar/123 -- Title: abcdefg -- (unlinked)
    POST:pages/={foo/bar/123}/move?name=456789&title=hijklmno
    New Location: /foo/bar/456789 -- Title: hijklmno -- (unlinked)
    
    Case 7 - parentid=pageid, title=string

    Move the page (and all subchildren) to child of page with pageid given in the 'parentid' parameter. The page title is changed to the value given in the 'title' parameter. The page title is set to the 'title' value and the URI title is reset to the title value given.

    Passing a title and not a name forces the page into a "linked" state.

    Old Location 1: /foo/bar/123 -- Title: abcdefg -- (unlinked)
    Old Location 2: /oof/rab/321 (Page ID = 12345)
    POST:pages/={foo/bar/123}/move?parentid=12345&title=pqrstuv
    New Location 1: /foo/bar
    New Location 2: /oof/rab/321/pqrstuv -- Title: pqrstuv -- (linked)
    
    3 Parameters
    Case 8 - name=path, parentid=pageid, title=string

    Moves page (and all subchildren) of final segment in the URI parameter to path "name" as a child of "parentid" with title "title".

    If name == title, the page's state will be set to linked. Otherwise it will be unlinked. See case 2 above.

    Old Location 1: /foo/bar/123 -- Title: rocknroll -- (unlinked)
    Old Location 2: /oof/rab/321 (Page ID = 789)
    POST:pages/={foo/bar/123}/move?name={new}&parentid=789&title=thisissparta
    New Location 1: /foo/bar
    New Location 2: /oof/rab/321/new -- Title: thisissparta -- (unlinked)
    Case 9 - Empty parameters

    Any and all empty parameters should return a Bad Request.

    Extra Test Cases

    The introduction of a linked attribute as well as path and title limitations require several more test cases to verify correctness.

    Case  Description
    10 Linked tests: conditions for linking and unlinking. Also attribute inspection custom/fixed/none
    11 Display title correctness (at least one character, whitespace trimming)
    12 Name correctness (underscores, slashes, etc)
    13 Display title to name conversion correctness
    14 Miscellaneous - Correct aliasing, no page cycles, etc
    Tag page

    Files 9

    FileVersionSizeModified 
    • v1
    • 1059.21 kB
    • 17:08, 7 Apr 2010
    •  
    Viewing 15 of 19 comments: view all
    @neilw - yes, the page creation is then a problem. this would be a lot less of a problem if the page layouts spec gets implemented - http://developer.mindtouch.com/Deki/Specs/Page_Layouts - within the workflow, we would also ask for the page title as well as the page type.

    this would keep things consistent by keeping the title editing experience outside the editor. perhaps these two specs need to be implemented at the same time... edited 14:55, 3 Nov 2009
    Posted 14:53, 3 Nov 2009
    Note that this behavior would need to co-exist nicely with wiki.create().

    The disadvantage of having to pre-name the page is that, very often, I'm not really sure what I want the name to be until after I've entered some content. Of course, you can always start with a name, and then change it later, but I kind of like having the option of tweaking the name until the last second.

    Nonetheless, I would *gladly* trade this for a solution to the problem original specified here.
    Posted 13:40, 4 Nov 2009
    I would like to see sort order decoupled from title entirely, and achieved by some kind of "sort order" property on the page, and/or a linked list of child order; moving a page should be achieved by dragging it around in the nav list. (Sales answer: should be trivial with jquery, no? :)

    As for the URI/title, I think that the old behaviour, whereby you edit the page title and the URL also changes, was superior (and afaict the only reason to change was sort order), so if the first point was implemented, we could return the second point, perhaps as Roy said about an in-place edit.
    Posted 01:10, 5 Nov 2009
    I am so glad that someone is finally addressing this, it causes lots of confusion on our wiki. I personally think that the URI and the page title should be locked together -- you can't change one without the other being changed. edited 06:03, 6 Nov 2009
    Posted 06:02, 6 Nov 2009
    I note with some interest/amusement how my thesis is 180 degrees off the original spec that started this: http://developer.mindtouch.com/Deki/Specs_%28Implemented%29/Page_Titles.

    I wonder what the real experience of users is? I have found that they are generally confused by the current mode of operation, but that original spec suggests that they were confused by the old way too...
    Posted 11:32, 11 Nov 2009
    Yes Please! I see mostly confusion around this. It took me some time to figure out what was going on myself, and I never did discover the technique of delete-title-and-save to get things back in synch (thanks!). I think the default behaviour should be to keep the page title and uri in lock-step, and that if someone does have a need to change the uri alone, then they should be using a "change uri of this page" command and not rename or move.

    In my experience to most people the intuitive understanding of "rename" is to change the title of this doc but leave it right here, while "move" means take this doc from here and place it over there (and optionally change the title in the process).

    I personally wouldn't want to have rename title be a separate action from edit and save (#3), unless perhaps it was vastly faster, but would still prefer that to the current process. edited 02:44, 20 Dec 2009
    Posted 02:39, 20 Dec 2009
    All of our users so far expect that the name of the page title and the uri will be the same. So people are confused / frustrated when you tell them you have to use Move to effectively keep the two the same.
    Is it possible to make this a global admin setting with per user over-ride preference ? Global admin setting that means when any user changes the title the uri also is changed to match.
    Posted 15:51, 27 Jan 2010
    @rberinger @neilw i'm going to hijack this spec and polish it up - i think there's a strong case for improving this in olympic, and this spec has a lot of the basic problems already identified. i hope i can address all the good problems raised in the comments!
    Posted 16:51, 12 Mar 2010
    @royk
    Go for it! It'll be great to see this addressed somehow.
    Posted 16:57, 12 Mar 2010
    @royk
    This is looking good, but I have a few questions:

    1) Are you confident that most users will be able to find the "move page icon"? On a number of occasions, I've encountered users who don't know that you can mouse over the headings and edit only one section. They just always hit the "edit page" button. So, with the proposed UI, I'd expect some "how do I rename my page?" questions, for sure. Perhaps I'll poll my users and see what they really know.

    2) When creating a new page, does it just work like it does now (<h1> element at the top of the editor)? Will it confuse users that sometimes the title appears in the editor and sometimes it doesn't? I really don't know, just wondering.

    3) If I uncheck the box and set the page title to be different from the URL, how do I restore it to sanity? In the current UI, you delete the title in the editor and it reverts (this is very obscure and mysterious). Is there an obvious shortcut to "revert page title back to URL"?

    4) Related to #3, If I've already diverged the title and URL, when I edit the title will the checkbox be checked by default or not? I'm not sure which way it should go, but you should specify what it's going to do.

    5) My gut tells me that the "Update permalink" message should be generic, not showing the actual new URL. Most users don't have a clue about any of this to begin with; showing the URL presents visual noise that is distracting.
    Posted 05:12, 18 Mar 2010
    1.) is a concern of mine as well. while the feature won't be as discoverable, it will be more usable. that's a trade-off i'm willing to risk in its initial pass (although an alternative would be to add another drop-down menu "rename page" which would trigger the same action)

    2.) no, the <h1> elements will disappear from all editor sections. the editor will just edit the contents of the page.

    3.) not sure if this use case will be covered. they can simply rename the page with the checkbox on to return it to sanity. the "wipe to sanity" seems like an odd notion.

    4.) the checkbox always remains checked, even in the case of divergence. this is to nudge display titles and URLs as aligned as possible. divergence seems to be an edge case, and more often than not it's the result of unexpected behavior.

    5.) the only reason i'd keep the URL in the update permalink is because of use case #4. if we assume divergence is an edge case, there should be more sanity checks before big operations are undertaken. edited 16:27, 18 Mar 2010
    Posted 10:25, 18 Mar 2010
    @royk
    > 2.) no, the <h1> elements will disappear from all editor sections. the editor will just edit the contents of the page.

    So what happens when you create a new page?
    Posted 11:14, 18 Mar 2010
    @neilw - see the second screenshot at http://developer.mindtouch.com/en/docs/MindTouch/Specs/Page_Layouts
    Posted 16:27, 18 Mar 2010
    i should note that the two features don't look symmetrical in UI yet - i'll converge the designs a bit more.
    Posted 16:28, 18 Mar 2010
    @royk @neilw I did an analysis of the page path & title use cases on the talk page. please take a look and let me know where my analysis is faulty: http://developer.mindtouch.com/index.php?title=Talk:en/docs/MindTouch/Specs/Clarified_Page_Title//Move_Functionality
    Posted 07:25, 19 Mar 2010
    Viewing 15 of 19 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by