Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-08-28 19:42:05

zenman
Member
Registered: 2017-08-28
Posts: 41
Website

How to remove slash in section url?

Reading the oficial Textpattern blog I have noticed that section urls do not have slash (/) at the end.
Usually when using <txp:section /> tag, section url always ends with /
How was this achieved?

https://textpattern.com/weblog

Instead of

https://textpattern.com/weblog/

Thanx.

Offline

#2 2017-08-28 20:07:44

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: How to remove slash in section url?

The sections are hard coded in that site, not dynamically generated. It saves database queries and render time. The way I work on templates, I tend to only makes things dynamically generated if it really needs to be, otherwise I hard code it into the html.

Offline

#3 2017-08-29 05:51:13

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,102
Website

Re: How to remove slash in section url?

As a sidenote – TXP 4.6 adds the the closing / to some tags but not all. TXP 4.7 (under development) will be more consistent and never use that closing /.

That is the case for the <txp:section /> tag for example.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#4 2017-08-29 06:10:49

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

Re: How to remove slash in section url?

phiw13 wrote #306749:

As a sidenote – TXP 4.6 adds the the closing / to some tags but not all. TXP 4.7 (under development) will be more consistent and never use that closing /.

That is the case for the <txp:section /> tag for example.

H Philippe,

I would disagree with that:)

The way I use sections is more like directories so the trailing slash is very important and semantically correct.

the way static sites work makes sense to me

  • Home
  • /section/
    • /section/article 1
    • /section/article 2

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

Offline

#5 2017-08-29 06:20:46

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,102
Website

Re: How to remove slash in section url?

colak wrote #306750:

I would disagree with that:)

it is not me who made that change… (and I’m not entirely happy with it, FWIW). I do eventually see the logic in that TXP 4.6 would output different things depending on which tag you use. TXP 4.7 is more consistent.

And FWIW, i am slowly going through various sites I made and check the URLs – in some cases I have the build the URL more manually to keep things as they were.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#6 2017-08-29 06:40:32

zenman
Member
Registered: 2017-08-28
Posts: 41
Website

Re: How to remove slash in section url?

colak wrote #306750:

H Philippe,

I would disagree with that:)

The way I use sections is more like directories so the trailing slash is very important and semantically correct.

the way static sites work makes sense to me

  • Home
  • /section/
    • /section/article 1
    • /section/article 2

If I use url like site.com/title, I d’ like to have all urls without slash to be consistent.

This scheme

site.com/section/
site.com/title

Looks a little confusing. Not important for SEO though.

Last edited by zenman (2017-08-29 07:08:19)

Offline

#7 2017-08-29 09:39:33

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

Re: How to remove slash in section url?

zenman wrote #306752:

If I use url like site.com/title, I d’ like to have all urls without slash to be consistent.

This scheme

site.com/section/
site.com/title

Looks a little confusing. Not important for SEO though.

this is true but unless you have specific reasons, you could work without using sections as the override form function could be used to manipulate the layout of the page anyway. Although I do not believe that we should be slaves to SEO, I do believe that urls have semantic significance for the seasoned surfer.


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

Offline

#8 2017-08-31 04:28:53

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 308
Website GitHub GitLab Twitter

Re: How to remove slash in section url?

I want to strictly follow this semantic standard, too. And would like to know, is there some native method in Textpattern, preventing Google to access section without ending slash in URL?

Offline

#9 2017-08-31 11:29:22

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: How to remove slash in section url?

Yes, use link canonical in your page <head> to tell search engines which pattern of URL should be indexed:

<link rel=canonical href="https://example.com/example-section">

Offline

#10 2017-08-31 13:50:43

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

Re: How to remove slash in section url?

phiw13 wrote #306751:

it is not me who made that change… (and I’m not entirely happy with it, FWIW). I do eventually see the logic in that TXP 4.6 would output different things depending on which tag you use. TXP 4.7 is more consistent.

And FWIW, i am slowly going through various sites I made and check the URLs – in some cases I have the build the URL more manually to keep things as they were.

It was me (here), but I don’t have an established opinion re the trailing slash. The main potential issue for me is that

  • child URL relative to /base/ is /base/child
  • child relative to /base is (perhaps surprisingly) /child

This could break pre-4.7 hard-coded relative URLs, but it’s yet time to revert back to 4.6-style links.

Offline

#11 2017-08-31 14:18:54

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: How to remove slash in section url?

Brief aside but this thread is giving me acid flashbacks. Personally, I have never liked trailing slashes for individual urls.

This seems to be Google’s official stance.

This is the most recent article I found.

Offline

#12 2017-08-31 18:35:08

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

Re: How to remove slash in section url?

This could break pre-4.7 hard-coded relative URLs, but it’s yet time to revert back to 4.6-style links.

I hope not. Our main site depends on the trailing slash on the section url


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

Offline

Board footer

Powered by FluxBB