Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2020-01-07 16:33:15

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Breadcrumbs on 4.8 beta

I know this doesn’t answer your (interesting) question but I wonder if you can simplify your task by making /departments/chemistry/ the section, i.e. both parts. You might need departments-chemistry for that in the backend. That might be tolerable if departments/ on its own has very few pages – for example just an overview. You’d them have:

tld.com/departments_» a section (or even a title-only article)_
tld.com/departments-physics _» a section_
tld.com/departments-physics/staff _» a section + category filter on list page_
tld.com/departments-physics/staff/person _» an individual article_
tld.com/departments-chemistry _» a section_
tld.com/departments-chemistry/staff _» a section + category filter on list page_
tld.com/departments-chemistry/staff/person _» an individual article_
…

As you’d have the department name in the section name, you’d also know where you are on any given page and therefore be able to derive the backlink to the next level above. At the individual article level you should be able to derive the backlink anyway from the categories assigned to it?

Of course, this whole suggestion depends on the departments section not requiring much in the way of sub-pages. If the minus sign is a problem, you could always use htaccess to rewrite it from a slash to a minus behind the scenes. Also there may be a way of using a mini-plugin that hooks into the url handling to consider /department/department-name as one section. There’s a callback for that which Oleg showed me once for manipulating the incoming url parts when experimenting with a language component in the url.


TXP Builders – finely-crafted code, design and txp

Offline

#14 2020-01-07 16:45:42

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Breadcrumbs on 4.8 beta

colak wrote #320896:

I guess, that the breadcrumbs solution above, is sufficient for this thread

Yes, you should be able to solve it with a page like this (latest dev):

<body>
    <header>
        <txp:section link title />
        <txp:if_individual_article>
            <txp:category1 link title this_section wraptag="/ <+>" />
            <txp:if_article_category number="2">/
                <a href="<txp:section url /><txp:category1 wraptag="<+>/" /><txp:category2 wraptag="<+>/" />"><txp:category2 title /></a>
            </txp:if_article_category>
        <txp:else />
            <txp:variable name="c1" value='<txp:page_url type="2" />' />
            <txp:variable name="c2" value='<txp:page_url type="3" />' />

            <txp:if_variable name="c1" value>/
                <a href="<txp:section url /><txp:variable name="c1" />/"><txp:category name='<txp:variable name="c1" />' title /></a>
            </txp:if_variable>
            <txp:if_variable name="c2" value>/
                <a href="<txp:section url /><txp:variable name="c1" />/<txp:variable name="c2" />/"><txp:category title /></a>
            </txp:if_variable>
        </txp:if_individual_article>
    </header>

    <!-- Main content -->
    <main>
        <txp:if_individual_article>
            <txp:article />
        <txp:else />
            <txp:article match="Category1=2, Category2=3" form="article_listing" />
        </txp:if_individual_article>
    </main>
</body>

I’m still trying to solve the issue here.

one thing at a time :-)

Offline

#15 2020-01-07 16:57:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Breadcrumbs on 4.8 beta

jakob wrote #320902:

I know this doesn’t answer your (interesting) question but I wonder if you can simplify your task by making /departments/chemistry/ the section, i.e. both parts. You might need departments-chemistry for that in the backend. That might be tolerable if departments/ on its own has very few pages – for example just an overview. You’d them have:

Well that was just an example. In the case for my site it would mean creating a new section for every new project which will make the sustainability suffer. For uni sites, there are normally dedicated teams working on them. At NeMe, we are three part time people doing everything, and the site is just on me:(

The deeper type urls are very exciting and once we crack how they work, they will become indispensable!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#16 2020-01-07 17:05:47

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Breadcrumbs on 4.8 beta

etc wrote #320903:

Yes, you should be able to solve it with a page like this (latest dev):

<txp:variable name="c1" value='<txp:page_url type="2" />' />
<txp:variable name="c2" value='<txp:page_url type="3" />' />

and …

<txp:article match="Category1=2, Category2=3" …

Woah! That’s cool.

So the first example is get the url parts split by a /? And the second one means, match url-part-2 to Category1 and url-part-3 to Category2?


TXP Builders – finely-crafted code, design and txp

Offline

#17 2020-01-07 17:12:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Breadcrumbs on 4.8 beta

etc wrote #320903:

Yes, you should be able to solve it with a page like this (latest dev):

<txp:article match="Category1=2, Category2=3" form="article_listing" />

Interesting! but I’m not sure that I understand this part: match="Category1=2, Category2=3"

> Edit Julian was faster:)

Last edited by colak (2020-01-07 17:15:01)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#18 2020-01-07 18:55:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Breadcrumbs on 4.8 beta

I’ve split the topic in order to keep this thread focused, for future reference.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#19 2020-01-07 22:05:17

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Breadcrumbs on 4.8 beta

colak wrote #320909:

Interesting! but I’m not sure that I understand this part: match="Category1=2, Category2=3"

> Edit Julian was faster:)

Yes, what Julian says. Moreover, Category1/2 can be filtered by URL variables: match="Category1=var1, Category2=var2" like other cf.

And if you need to select the articles with, say, not empty Category2, the syntax is

<txp:article_custom category match="Category2" ... />

And to exclude them

<txp:article_custom category match="Category2" exclude="category" ... />

Offline

#20 2020-01-08 07:04:51

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Breadcrumbs on 4.8 beta

I feel like a total idiot as I still do not get it:(
Could someone post a couple of url examples and how they are represented by the tags?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#21 2020-01-08 10:29:31

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Breadcrumbs on 4.8 beta

colak wrote #320921:

Could someone post a couple of url examples and how they are represented by the tags?

It’s quite simple: to retrieve chemistry on this page

/departments/chemistry/staff/arrhenius

use

<txp:page_url type="2" />

since chemistry is the second (ltr) chunk of URL.

Offline

#22 2020-01-08 10:40:17

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Breadcrumbs on 4.8 beta

And match="Category1=2" syntax on /departments/chemistry/staff/arrhenius means articles with Category1='chemistry'. Alternatively, if your links were of the form

/departments/?name=chemistry&role=staff&person=arrhenius

you could retrieve chemistry with

<txp:page_url type="name" />

and match Category1 against it with match="Category1=name".

Offline

#23 2020-01-08 12:04:50

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Breadcrumbs on 4.8 beta

In your example is arrhenius corresponding to <txp:page_url type="4" /> or are these types only for sections and categories since we have article_url_title to detect the article titles? Also, Arrhenius should retire and offer his position to younger staff:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#24 2020-01-08 12:47:18

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Breadcrumbs on 4.8 beta

colak wrote #320926:

In your example is arrhenius corresponding to <txp:page_url type="4" />… ?

Yes, numeric types are agnostic of their txp role.

Also, Arrhenius should retire and offer his position to younger staff:)

The government has decided he must work a little more (local retirement reform actuality).

Offline

Board footer

Powered by FluxBB