LulububuSoftwareGmbH / boltredirector

Handles 301 redirects in Bolt CMS.
16 stars 8 forks source link

Add support for a filtering system #4

Closed mikerockett closed 8 years ago

mikerockett commented 10 years ago

Whilst building a site on Bolt, I found the need to redirect /share-on/<social_network>/<slug> to the respective social network's sharing URL. As such, I thought that URL encoding should be done before the actual redirect.

So, I'm working on a quick feature-add that let's you do this:

share_on_facebook:
    from: 'share-on/facebook/{path}'
    to: 'https://www.facebook.com/sharer/sharer.php?u=[{@url_root}/{path}|e]'

Notice the square brackets with the |e? That's the new filtering 'system'. It'll perform all the necessary replacements, and then encode the result.

Other filters will be:

be: Base 64 Encode bd: Base 64 Decode

If you can think of any others that should be added, please do add them in the comments.

(PS: @url_root is a new global variable, which imports the current host URL.)

mikerockett commented 10 years ago

@bobdenotter: What do you think?

mikerockett commented 10 years ago

Perhaps the following could also work?

to: '{facebook:path}'

This would translate to the original. The same could be applied to other social networks. In fact, social networking links could be a separate feature-add...

bobdenotter commented 10 years ago

Interesting.. I've never thought about redirecting share links through Bolt. I'm wondering, what is the use-case for this? Usually, you'd create good looking links for either the ease of your visitors, or to improve your searchengine ranking. How does this fit into that? It's not something somebody would link to from an external resource.. And I don't think Google should index those share-links either..

mikerockett commented 10 years ago

To be honest, I just like links that look good. It's also, per #5, good for logging share links. I don't think it should be implemented if we conclude that it won't be used much. So, let's leave this for now - if people want it, then I can plug it in.

I think that the most important thing to look into now is being able to support full URI's, including parameter strings. I'm not the greatest coder, and so I kept getting stuck whilst trying to implement it.

So, I need to look into #1 and perhaps create a new issue for working with query parameters.

bobdenotter commented 10 years ago

Don't let my opinion on this stip you from implementing it! :-)

This is typically one of those features that are nice to have for those who want it, but they don't get in the way for people who don't need them. If you like the clean share links just for the sake of clean links, then by all means you should implement it! ;-)

mikerockett commented 10 years ago

Well, you said "I've never thought about redirecting...", and I realised that that would be the case for most people. I'll give it a bit more thought first. :)

mikerockett commented 10 years ago

Okay, thoughts given.

I won't be doing anything that points towards social sharing. Instead, I'll just focus on encoding and base64.

I also need to be able to match the GET array, which is in the queue of things to do.