diff --git a/_config.yml b/_config.yml
index 8ea31edd3..810f8fd28 100755
--- a/_config.yml
+++ b/_config.yml
@@ -531,6 +531,7 @@ firestore:
collection: articles #required, a string collection name to access firestore database
apiKey: #required
projectId: #required
+ bluebird: false #enable this if you want to include bluebird 3.5.1(core version) Promise polyfill
# Show PV/UV of the website/page with busuanzi.
# Get more information on http://ibruce.info/2015/04/04/busuanzi/
diff --git a/layout/_third-party/analytics/firestore.swig b/layout/_third-party/analytics/firestore.swig
index 3cd5f7c7f..7493c75f2 100644
--- a/layout/_third-party/analytics/firestore.swig
+++ b/layout/_third-party/analytics/firestore.swig
@@ -1,54 +1,99 @@
{% if theme.firestore.enable %}
-
-
-
+
+ {% if theme.firestore.bluebird %}
+
+ {% endif %}
+
+ var promises = titles.map(function (title) {
+ return articles.doc(title)
+ }).map(function (doc) {
+ return getCount(doc)
+ })
+ Promise.all(promises).then(function (counts) {
+ var metas = $('.post-meta')
+ counts.forEach(function (val, idx) {
+ appendCountTo(metas[idx])(val)
+ })
+ })
+ }
+ })()
+
{% endif %}