Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-07-01 08:03:08

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Modify file download url

How can I remove the underscore from the url generated by file_download_link ?

Last edited by wornout (2013-07-01 08:04:15)

Offline

#2 2013-07-01 08:57:59

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

Re: Modify file download url

Do you mean in this type of URL?

http://www.example.com/file_download/2/example.zip

Offline

#3 2013-07-01 08:59:48

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Modify file download url

Yes!

Offline

#4 2013-07-01 09:16:19

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

Re: Modify file download url

I think it’s on line 309 of publish.php in Textpattern 4.5.4

$out['s'] = 'file_download';

I don’t think there’s a way to change it without manually amending the core though.

Offline

#5 2013-07-01 09:31:20

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Modify file download url

Thanks!

Offline

#6 2013-07-01 12:36:44

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

Re: Modify file download url

Setting 'file_download' => 'myFileDownload' in wet_babble could be a plugin alternative, though it depends on what you need exactly.

Offline

#7 2013-07-01 12:45:35

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Modify file download url

My purpose is to remove underscores from file link.
From this:

http://www.domain.it/file_download/etc...

to this:

http://www.domain.it/file-download/etc...

for example.

Offline

#8 2013-07-01 12:54:06

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

Re: Modify file download url

Should the modified links still be treated as txp file download links? Then try 'file_download' => 'file-download' in wet_babble. Otherwise, you can pass them trough rah_replace, but Textpattern won’t recognize them as download links anymore.

Offline

#9 2013-07-01 13:22:39

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Modify file download url

etc wrote:

Should the modified links still be treated as txp file download links? Then try 'file_download' => 'file-download' in wet_babble.

It works!

Offline

#10 2013-07-01 13:41:41

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

Re: Modify file download url

Fine (edit: save in messy mode)! I guess you can add some file_download string to txp_lang table to get the same result.

Last edited by etc (2013-07-01 13:43:31)

Offline

#11 2013-07-01 13:42:21

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

Re: Modify file download url

Just curious as to why you’d want to change that URL in the first place?

Offline

#12 2013-07-01 13:50:22

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Modify file download url

Because of SEO checker tool:

Great, you are not using ‪‬underscores (these_are_underscores) in your URLs.
While Google™ treats hyphens (these-are-hyphens) as word separators, it does not treat underscores as word separators.

It was report as an error in the site review. It doesn’t have a big impact as well…

Last edited by wornout (2013-07-01 13:51:30)

Offline

Board footer

Powered by FluxBB