# WriteFreely blog as Progressive Web App

**URL:** <https://discuss.write.as/t/writefreely-blog-as-progressive-web-app/1212>\
**Category:** Feature requests\
**Created:** [March 23, 2020, 2:11pm UTC](https://discuss.write.as/t/writefreely-blog-as-progressive-web-app/1212 "2020-03-23T14:11:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gytisrepecka](https://discuss.write.as/user_avatar/discuss.write.as/gytisrepecka/32/233_2.png) [@gytisrepecka](https://discuss.write.as/u/gytisrepecka)\
**Post date:** [March 23, 2020, 2:11pm UTC](https://discuss.write.as/t/writefreely-blog-as-progressive-web-app/1212/1 "2020-03-23T14:11:44Z")

</div>

It would be convenient to have WriteFreely blogs exposed as [Progressive Web App](https://en.wikipedia.org/wiki/Progressive_web_application)s - they increase visitor engagement by adding sites to their mobile devices as apps and therefore having much easier access. Also PWA has nice visual appeal by adding color to browser tab when visiting. Making blogs exposed as PWAs can be implemented following [Gitea](https://gitea.io)’s example:

Expose JSON file with colors, title and icons like:

```auto
{
    "short_name": "Gitea",
    "name": "Gitea - Git with a cup of tea",
    "icons": [
      {
        "src": "/img/gitea-lg.png",
        "type": "image/png",
        "sizes": "880x880"
      },
      {
        "src": "/img/gitea-sm.png",
        "type": "image/png",
        "sizes": "120x120"
      },
      {
        "src": "/img/gitea-512.png",
        "type": "image/png",
        "sizes": "512x512"
      },
      {
        "src": "/img/gitea-192.png",
        "type": "image/png",
        "sizes": "192x192"
      }
    ],
    "start_url": "/",
    "scope": "/",
    "background_color": "#FAFAFA",
    "display": "standalone",
    "theme_color": "#6cc644"
  }

```

And link it in site HEAD:

```auto
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials">

```

Steps to implement:

- Each blog should have own manifest JSON generated based on customization settings;
- Favicon/icon upload and resize needed (maybe as part of [image upload implementation](https://phabricator.write.as/T550));
- Add and use JavaScript color picker to help choose color(s).

---

<div class="post-metadata">

**Author:** ![cjeller1592](https://discuss.write.as/user_avatar/discuss.write.as/cjeller1592/32/128_2.png) [@cjeller1592](https://discuss.write.as/u/cjeller1592)\
**Post date:** [March 24, 2020, 4:05pm UTC](https://discuss.write.as/t/writefreely-blog-as-progressive-web-app/1212/2 "2020-03-24T16:05:31Z")

</div>

That’s a great idea @gytisrepecka! It’d be especially interesting making it a PWA helped you write to your WF blog easier on mobile. Have you tried to implement it on your blog yet? I’d be curious to see it in action.

---

<div class="post-metadata">

**Author:** ![gytisrepecka](https://discuss.write.as/user_avatar/discuss.write.as/gytisrepecka/32/233_2.png) [@gytisrepecka](https://discuss.write.as/u/gytisrepecka)\
**Post date:** [March 24, 2020, 4:47pm UTC](https://discuss.write.as/t/writefreely-blog-as-progressive-web-app/1212/3 "2020-03-24T16:47:23Z")

</div>

From technical point-of-view Progressive Web App is rendered using Android’s internal browser engine (Chromium), so it would work pretty much the same as user visiting WriteFreely on browser. On the other hand, user skips one step: no need to open browser and go to website when you already have an icon between apps.

I need to explore more if maybe login credentials could be stored in generic Android Accounts framework - that would be awesome 😌

I am in progress setting up development environment on CentOS 7/8, will post some screenshots as soon as I have working prototype 🤓

---

<div class="post-metadata">

**Author:** ![gytisrepecka](https://discuss.write.as/user_avatar/discuss.write.as/gytisrepecka/32/233_2.png) [@gytisrepecka](https://discuss.write.as/u/gytisrepecka)\
**Post date:** [April 15, 2020, 1:56pm UTC](https://discuss.write.as/t/writefreely-blog-as-progressive-web-app/1212/4 "2020-04-15T13:56:01Z")

</div>

To gather bits and pieces needed for implementation, I’ve set up PWA on [my company’s minisite](https://inretio.dev/). Here are the components required:

- Meta tags in site’s `head`;
- Shortcut icons (PNG) in different sizes ([image upload](https://phabricator.write.as/T550) would help here, perhaps with [my small library with added resizer](https://source.gyt.is/gytisrepecka/webimg/commit/aceb90949af56baa1f3343bf9f66c87d14c62b6d) as well);
- `manifest.json` with application details (name, description, icons, theme color, etc.) - this should be generated for each blog based on settings (blog customization page);
- JavaScript worker to cache elements for web app offline view - most likely common for whole installation of WriteFreely unless each blog has separate logo image. Otherwise only `css/write.css` needs to be cached.

For the reference, some reading:

- [Google Developers (web.dev)](https://web.dev/progressive-web-apps/)
- [PWA on Samsung Internet app](https://hub.samsunginter.net/docs/ambient-badging/)
- [PWA on Firefox](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Add_to_home_screen#How_do_you_make_an_app_A2HS-ready).

When I think about offline page it perhaps should be editor (home page of logged-in user) - that way, say, being on airplane would enable user to write his/her blog. It’s exciting to know that [PWA can use database](https://developers.google.com/web/ilt/pwa/working-with-indexeddb) in similar nature as usual app does and have [long-lived sessions](https://developers.google.com/web/updates/2016/06/2-cookie-handoff) for authenticated users. More coolstuff for implementation details [here](https://web.dev/pwa-checklist/).
