-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ne pas transformer tous les caractères non-ascii en leur version html #831
Comments
Have a look here: https://github.com/getpelican/pelican/blob/master/pelican/themes/notmyidea/templates/article.html#L2 Does that help address the (cc: @bbinet, since he may be better-positioned linguistically to assist) |
Oh thanks a lot ! I do speak english but somehow I just used my mothertongue. Probably because the doc also exists in French. I'll give it a try tonight and again thanks for your kind reply ! Justin Mayer notifications@github.com schrieb:
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. |
Your suggestion did work, you can check it there with the facebook debugger : https://developers.facebook.com/tools/debug Wonderful ! In order for me to validate html5, do you also know how to ask to pelican to escape correctly urls, I mean with %20 instead of spaces. There : https://github.com/sploinga/traductions/blob/master/bootstrap2/templates/article_infos.html for example, if I could not only give to facebook and twitter the article.title, but also the article.title|correct format for the url, it would be very nice! Btw, thanks a lot for this great piece of software. Simple and powerful at the same time. |
You could try looking at the Jinja docs; perhaps something in the following section might work: http://jinja.pocoo.org/docs/templates/#builtin-filters |
OK great this is the doc I missed. Will first look there next time :) Thanks again !
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. |
No problem. Is there anything else we can do to assist regarding this issue? |
nope i think i found out. In jinja 1 there was an urlencode function, but they dropped it in jinja 2 apparently to be encoding agnostic. See pallets/jinja@37303a8 and pallets/jinja#17 . What I did was simply to grab the code proposed there and add it locally to my filters.py in my jinja installation. This is not very safe because next time i update it it will be erased, but at least it works. code is simply :
quote_plus comes from urllib. Then, in my template, i striptag before i urlencode, and pof it works correctly according to facebook debugger, the w3c validator, and the html source code. It might be a good idea to integrate some custom jinja filters such as this one in pelican, or to recommand striptagging title and description for sharing websites ? For this filter you only need to force utf-8 on everyone, don't know if you want that. Again, thanks a lot for your very helpful and much appreciated remarks ! |
@sploinga, you can add additional Jinja filters with Pelican. Define that function in your settings file and also add the following in settings.
Now you can use that filter and you won't lose it when you update. |
Great, I'll do it soon that way, thanks ! :) Now that you two did answer everything I could hope for, I think it's safe to assume you can close the issue ;) |
Glad to hear it. Issue closed. |
Je viens de mettre en place sur un blog à http://traductions.sploing.fr/index.html et quand on regarde le code source de la page, tous les caractères non-ascii sont transformés en leur équivalent html, ce qui le rend plus difficilement lisible et réutilisable par Facebook et co, comme par exemple pour le titre de cet article : http://traductions.sploing.fr/novlangue/2013/04/06/peche-fiscal/ où un nbsp; remplace un bête espace. Est-ce qu'il ne serait pas possible de laisser le texte utf-8 tel quel ? Après tout, c'est ce qui est déclaré en en-tête de la page ici.
The text was updated successfully, but these errors were encountered: