• Hi,

    I have posted also this topic into the hacks forum .
    His content make that it belongs to both these forum :
    – first in time into the development that I have engaged on which I need help for the hack of WP core
    – second point is because the development that I began is the result of a request and feedback as user which must be formulated here.

    I changed a little the presentation of the content for here to be nearer from the “request and feedback” set as main subject.

    The fact : It seems well that, when “paginated posts” are used the fragment identifiers cannot be used easily into the post or from exterior (see detailed note), because the pages are identified by their number (page=<num_page>) which is not a stable data.
    This makes quite impossible or at minimum very difficult to develop and test internal links and maintain long paginated documents with many fragments identifiers because the pagination can easily change during text development and after all along updates.

    note :For clarity : no confuse between “pages” and “pages of paginated posts), the concept of an article page is replaced, for user interface, by “article section” (concept which covers easily : parts, main chapters, which uses are naturally extended to summary, bibliography, indexes etc.)

    My analysis of the nature of the problem is :

    The “styling pages link” ( which is essential with regard to other criteria) brakes the concept of “spaces in html/xml”.
    A “post” is no more, with the pagebreak feature, an xml/html “space”, it is the “section (page of post) which becomes the xml/html space, but it is the post which is managed as a main entity by WP (categorized, editing, status, author, filtered etc…).

    The enhancement that I proposes restores a HTML/XML true space as a “section” for post paginated : divided into sections. The xml/html granularity is the “section” (and the page or post himself if no sections are defined)

    Explanation :
    When you creates a document a fragment identifier “#<fragment_name>” cannot be used if a <!–nextpage–> (or equivalent) is used into the document. The URI which should point points to the fragment is unknown because it can be only referenced with a “often unkown” identifier : the page number.
    This is proper to the multipage concept not at all to any multipage management plugin.

    I have not found anywhere information (and I worked a lot on this subject) about the way to define a fragment reference inside a multi page document a tag href or to externally reference a fragment which is contained into a multipage document.

    Elementary facts :
    1- Creating a post and later dividing into “sections” by using <!–nextpage–> : the internal fragment references as href:”#<fragment_id>” are if not belonging to same section holded anymore.

    2- Tools (plugins) for checking links are lost and give erratic results

    3- Table of content of post for whole post creates invalid links to <h[0-9] tags

    4- the copy link for external references gives a link which will be often broken

    Going towards the design and realisation of a development:

    After researches of existing solutions, I decide to develop “something” which is quite fully designed, the feasibility checked, too some main parts of code.

    For now, because I am new in WordPress developments I need some help.
    I don’t think at all that the problem is only a pluging problem.
    There are some things that I don’t know how to do for hacks.
    I do not know anymore where are good existing examples.

    The development features are :
    (to avoid errors we replace the “page” of paginated post by the “section” word : then a post can have sections)

    – A section can be named by the use of a shortcode associated with <!–nextpage–> into the document.
    – optional replacement of the url of section identified currently by his number : ‘<permalink>/<num_page>/’
    by
    A new syntax which is the unique way (in my opinion) to reach a fragment into a paginated post
    ‘<permalink>/section/<section_name>/’

    – determine and store the post datas which describes the post sections (needs a wp enhancement – add a column to post table, or badly a special table like for a plugin for storing the pagination data, updated when the post is saved) containing :
    post, version : table (json) with for each section (section_name, title, page_num)

    Then the steps of the incoming url treatment are :
    – with a add_rewrite_endpoint it becomes
    ‘<permalink>/?section=section_name’

    – with add_rewrite_tag we can get the new query arg [‘section’]
    – read first the sections data (pagination) from data base using the permalink

    Then I need to set into the current query the hook (set by add_action) to set the query var “page=<num_page>”, the only known identifier of the “section” known by other WP soft elements.
    (I don’t know how to do this : must be placed just at the query.php beginning ?)

    I am not sure of the sequence of actions (must be the first process : it builds the request for full compatibility giving section_name and old page number) and priorities.

    The other parts of the soft with which I have no problem at all are :
    When saving post :
    – treatment of the content to set the pagination (or sectionning) data (shortcodes) : creating data and optionally replacements to rebuild internal links of a paginated post.
    – writing pagination data “at” saving posts event.

    Note : to test, I developed a “at display” treatment which sets
    the internal good urls (as shortcodes) into href to fragments. This makes the fragment url identifiers displayed usable (replacement into urls of the section_name by the page number at display).

    But the external links cannot be obviously kept anywhere with reliability because links to fragments are broken by any pagination change while section_names are stable data.

    I think that it is not a so important work remaining (50 php instruction for all remaining probably).

    I think that this will be an interesting and necessary development.

    Best regards

    Trebly

    Reply

  • The topic ‘Stable links to fragments identifiers into paginated posts enhancement specs’ is closed to new replies.