|
|
Created:
Dec. 5, 2017, 11:19 a.m. by ire Modified:
Dec. 13, 2017, 7:16 p.m. Reviewers:
juliandoucette Base URL:
https://hg.adblockplus.org/website-defaults Visibility:
Public. |
DescriptionIssue 6013 - Add site name to document title in website-defaults standard metadata
Patch Set 1 #
Total comments: 2
Patch Set 2 : Translate page title suffix #
Total comments: 4
Patch Set 3 : Remove translation on get_string #
Total comments: 4
Patch Set 4 : Remove repeated markup #
Total comments: 2
MessagesTotal messages: 14
Why are you explicitly setting title_suffix to none and not *just* not defining title_suffix?
On 2017/12/05 16:30:04, juliandoucette wrote: > Why are you explicitly setting title_suffix to none and not *just* not defining > title_suffix? Because we want the default state to include a suffix. If I used the absence of a suffix, then we would have to set the `title_suffix` for every page we do want a suffix, instead of that being the default.
https://codereview.adblockplus.org/29630648/diff/29630649/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29630649/includes/meta/stand... includes/meta/standard.tmpl:11: {{ title | translate("page-title", "Page title") }} | {{ title_suffix }} You forgot the translate filter.
https://codereview.adblockplus.org/29630648/diff/29630649/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29630649/includes/meta/stand... includes/meta/standard.tmpl:11: {{ title | translate("page-title", "Page title") }} | {{ title_suffix }} On 2017/12/06 17:07:17, juliandoucette wrote: > You forgot the translate filter. Done.
This will look good to me after you remove the translate filter pointed out below. https://codereview.adblockplus.org/29630648/diff/29632573/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29632573/includes/meta/stand... includes/meta/standard.tmpl:4: Detail: This logic seems complicated. But I believe it is optimal. I have come up with a few alternatives, but they all involve more, unnecessary, conditions and do not make it *much* simpler. https://codereview.adblockplus.org/29630648/diff/29632573/includes/meta/stand... includes/meta/standard.tmpl:17: {{ get_string("name", "site") | translate("site-name", "Page title suffix") }} You don't need the translate filter after get_string. get_string get's the translation directly from the appropriate locale file.
https://codereview.adblockplus.org/29630648/diff/29632573/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29632573/includes/meta/stand... includes/meta/standard.tmpl:4: On 2017/12/08 15:44:56, juliandoucette wrote: > Detail: This logic seems complicated. But I believe it is optimal. I have come > up with a few alternatives, but they all involve more, unnecessary, conditions > and do not make it *much* simpler. Ack. I agree it's not very readable, but it was the most concise I could do. https://codereview.adblockplus.org/29630648/diff/29632573/includes/meta/stand... includes/meta/standard.tmpl:17: {{ get_string("name", "site") | translate("site-name", "Page title suffix") }} On 2017/12/08 15:44:56, juliandoucette wrote: > You don't need the translate filter after get_string. get_string get's the > translation directly from the appropriate locale file. Done.
LGTM after you address my comment below. https://codereview.adblockplus.org/29630648/diff/29635574/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29635574/includes/meta/stand... includes/meta/standard.tmpl:6: <title> There is no reason to repeat the opening and closing <title> inside this logic. e.g. if ... open title ... close title else ... open title ... close title vs. open title if ... ... else .. ... close title
Actually, wait... Not LGTM
https://codereview.adblockplus.org/29630648/diff/29635574/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29635574/includes/meta/stand... includes/meta/standard.tmpl:5: {% if title_suffix == 'none' or (not title_suffix and not has_string("name", "site")) %} suggest: <title> {{ title | translate("title", "Page title") }} {% if title_suffix %} {{ title_suffix | translate("title-suffix", "Page title suffix") }} {% elif has_string("name", "site") %} {{ get_string("name", "site") if has_string("name", "site") }} {% endif %} </title> Detail: String names are page specific and for developers (therefore shorter is better and "title" is meaningful aka document.title). String descriptions are for translators and should be human readable.
https://codereview.adblockplus.org/29630648/diff/29635574/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29635574/includes/meta/stand... includes/meta/standard.tmpl:5: {% if title_suffix == 'none' or (not title_suffix and not has_string("name", "site")) %} On 2017/12/12 16:52:45, juliandoucette wrote: > suggest: > > <title> > {{ title | translate("title", "Page title") }} > {% if title_suffix %} > {{ title_suffix | translate("title-suffix", "Page title suffix") }} > {% elif has_string("name", "site") %} > {{ get_string("name", "site") if has_string("name", "site") }} > {% endif %} > </title> > > Detail: String names are page specific and for developers (therefore shorter is > better and "title" is meaningful aka document.title). String descriptions are > for translators and should be human readable. Ack. I'm assuming you removed the `title_suffix == 'none'` condition and the `|` for brevity in your example? Also the repetition of the `has_string("name", "site")` statement. https://codereview.adblockplus.org/29630648/diff/29635574/includes/meta/stand... includes/meta/standard.tmpl:6: <title> On 2017/12/12 16:38:32, juliandoucette wrote: > There is no reason to repeat the opening and closing <title> inside this logic. > e.g. > > if ... > open title > ... > close title > else ... > open title > ... > close title > > vs. > > open title > if ... > ... > else .. > ... > close title Acknowledged. I did it this way because I think it's easier to read but you're right it's repetition for no reason. Will change in next patch
New patch set
LGTM + NIT https://codereview.adblockplus.org/29630648/diff/29637555/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29637555/includes/meta/stand... includes/meta/standard.tmpl:7: NIT: Unnecessary empty line?
https://codereview.adblockplus.org/29630648/diff/29637555/includes/meta/stand... File includes/meta/standard.tmpl (right): https://codereview.adblockplus.org/29630648/diff/29637555/includes/meta/stand... includes/meta/standard.tmpl:7: On 2017/12/13 15:01:10, juliandoucette wrote: > NIT: Unnecessary empty line? Done. |