Support » Plugin: PWA » Second word doesn’t show

  • Hi, i’m using your plugin on site https://marketing2.ru
    My sites name is “Другой Маркетинг”, but in Google Chrome (on Android) I can see only first word “Другой”.

    Is this a bug?

    Here is my manifest file – https://marketing2.ru/wp-json/wp/v2/web-app-manifest

    P.S. when I try to validate it here – https://manifest-validator.appspot.com/ I see this error^

    Error: Manifest is invalid!
    Manifest URL: https://marketing2.ru/wp-json/wp/v2/web-app-manifest
    File isn't valid JSON: SyntaxError: Unexpected token  in JSON at position 0
    Your JSON failed to parse, these are the main reasons why JSON parsing usually fails:
    - Double quotes should be used around property names and for strings. Single quotes are not valid.
    - JSON specification disallow trailing comma after the last property even if some implementations allow it.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    @codeby Hi there.

    The logic for determining the short_name can be found here: https://github.com/xwp/pwa-wp/blob/687e5661f869a281abda858d5b05704fbe6b2c99/wp-includes/class-wp-web-app-manifest.php#L131-L142

    Basically, it tries to truncate the name so it fits within 12 characters. It’s becoming increasingly clear that this logic is not going to work often and the short_name should be eliminated so that the full name is just truncated with an ellipsis or however an OS normally shows the title.

    Perhaps there should be a message when editing the Site Title that it should be less than 12 or provide a secondary app title field that should be shorter.

    Plugin Author Weston Ruter

    (@westonruter)

    I’ve filed an issue you can follow regarding short_name: https://github.com/xwp/pwa-wp/issues/181

    In regards to the manifest, it’s able to be loaded properly in Chrome.

    But if I try parsing it from the command line via curl I get no such luck:

    $ curl -s https://marketing2.ru/wp-json/wp/v2/web-app-manifest | python -m json.tool
    No JSON object could be decoded

    If I run this in a hex viewer the issue is revealed:

    $ curl -s https://marketing2.ru/wp-json/wp/v2/web-app-manifest | hexdump -C
    00000000  ef bb bf 7b 22 6e 61 6d  65 22 3a 22 5c 75 30 34  |...{"name":"\u04|

    Notice the bytes ef bb bf. These are the UTF-8 BOM (Byte Order Mark): https://en.wikipedia.org/wiki/Byte_order_mark

    It’s probably that you have one of your PHP files like wp-config.php that has been saved with this marker added. You should strip it prevent it from causing the JSON parse error. Your code editor likely has a feature to remove this marker.

    Thank you. Can you add to plugin option to enter a custom short_name? Because truncated name does not convey the essence.

    Plugin Author Weston Ruter

    (@westonruter)

    Yes, all you need to do is add this to your custom theme’s functions.php or a plugin:

    add_filter( 'web_app_manifest', function( $manifest ) {
        $manifest['short_name'] = 'whatever you like';
        return $manifest;
    } );

    Supply the desired short_name there.

    Thank you! I added domain name as short_name.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Second word doesn’t show’ is closed to new replies.