Re: [Tiki-devel] maketoc change of behaviour [wasRe: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[78055] branches/22.x]
Jonny Bradley via TikiWiki-devel <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Marc Actually in this case we need good ol' maketoc server-side as apparently (allegedly) Google likes to see a table of contents of what's in the page to index, and supposedly that helps the Page Rank and SEO - i've always been dubious about such things but the client is always right! :) Thanks for the feedback though ;) Should this be backported to 21.x and 18.x do you think? jonny > On 25 Feb 2021, at 13:27, [email protected] wrote: > > Makes sense. > > Hopefully, one day, we'll do all with PluginAutoTOC and deprecate maketoc which has many many issues. > > > On Thu, 25 Feb 2021 12:55:26 +0000 Tiki developers [email protected] said > >> Hi devs >> Just want to raise this change i've made in trunk and 22.x only so far. >> It was reported as a bug by a client that when using {makedoc} if the heading >> being "toc'ed" is a link, then the maketoc link looks to the heading's link >> href, not to the anchor on the page. >> This commit 2c5a99cf fixes that but with a new parameter for maketoc to >> restore the old (invalid html) behaviour, just in case. >> Any objections? >> TIA >> jonny >> > On 25 Feb 2021, at 12:36, jonnybradley--- via Tikiwiki-cvs >> > <[email protected]> wrote: >> > > Revision: 78055 >> > http://sourceforge.net/p/tikiwiki/code/78055 >> > Author: "jonnybradley" >> > Date: 2021-02-25 12:36:38 +0000 (Thu, 25 Feb 2021) >> > Log Message: >> > ----------- >> > [FIX][MOD] toc: Prevent {maketoc} from nesting links (or other html tags) in >> > the table of contents which makes the toc entry go to the headings linked href >> > instead of the anchor on the page. Can be overriden using {maketoc >> > removenestedlinks="n"} to preserve existing behaviour if needed (but it seems >> > like a bug to us) >> > > (cherry picked from commit b46bee672054675bfefd6005df6ca8b7168276d6) >> > > Modified Paths: >> > -------------- >> > branches/22.x/lib/parser/parserlib.php >> > > Property Changed: >> > ---------------- >> > branches/22.x/ >> > > Index: branches/22.x >> > =================================================================== >> > --- branches/22.x 2021-02-25 12:34:22 UTC (rev 78054) >> > +++ branches/22.x 2021-02-25 12:36:38 UTC (rev 78055) >> > > Property changes on: branches/22.x >> > ___________________________________________________________________ >> > Added: subgit:lock:2c5a99cfff03316afe1be6a72cf5138a844880ed >> > ## -0,0 +1 ## >> > +2021-02-25T12:36:37.284 >> > \ No newline at end of property >> > Deleted: subgit:lock:fc9a823b5b8de548ebcaa2ccc9ff891a0493f296 >> > ## -1 +0,0 ## >> > -2021-02-23T17:54:37.190 >> > \ No newline at end of property >> > Modified: branches/22.x/lib/parser/parserlib.php >> > =================================================================== >> > --- branches/22.x/lib/parser/parserlib.php 2021-02-25 12:34:22 UTC (rev >> > 78054) >> > +++ branches/22.x/lib/parser/parserlib.php 2021-02-25 12:36:38 UTC (rev >> > 78055) >> > @@ -2821,14 +2821,15 @@ >> > > // Set maketoc default values >> > $maketoc_args = [ >> > - 'type' => '', >> > - 'maxdepth' => 0, // No limit >> > - 'title' => tra('Table of contents', $this->option['language'], >> > true), >> > - 'showhide' => '', >> > - 'nolinks' => '', >> > - 'nums' => '', >> > - 'levels' => '' >> > - ]; >> > + 'type' => '', >> > + 'maxdepth' => 0, // No limit >> > + 'title' => tra('Table of contents', >> > $this->option['language'], true), >> > + 'showhide' => '', >> > + 'nolinks' => '', >> > + 'nums' => '', >> > + 'levels' => '', >> > + 'removenestedlinks' => 'y', >> > + ]; >> > > // Build maketoc arguments list (and remove " chars if they are around the >> > value) >> > if (isset($maketoc_regs[1])) { >> > @@ -2884,7 +2885,11 @@ >> > } else { >> > $tocentry_title = $tocentry['title_displayed_num']; >> > } >> > - $tocentry_title .= $tocentry['title']; >> > + if ($maketoc_args['removenestedlinks'] === 'y') { >> > + $tocentry_title .= strip_tags($tocentry['title']); >> > + } else { >> > + $tocentry_title .= $tocentry['title']; >> > + } >> > > // Generate the toc entry link >> > $tocentry_link = '#' . $tocentry['id']; >> > > This was sent by the SourceForge.net collaborative development platform, the >> > world's largest Open Source development site. >> > > > > _______________________________________________ >> > Tikiwiki-cvs mailing list >> > [email protected] >> > https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs >> > _______________________________________________ >> TikiWiki-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel > > > > > _______________________________________________ > TikiWiki-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel >