From b29273629e7b04305b038dd5df91940900cddc17 Mon Sep 17 00:00:00 2001 From: liangliang Date: Wed, 14 Jul 2021 22:28:42 +0800 Subject: [PATCH 1/3] update mapping --- blog/documents.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/blog/documents.py b/blog/documents.py index 44486c2..8e117b9 100644 --- a/blog/documents.py +++ b/blog/documents.py @@ -14,7 +14,7 @@ import elasticsearch.client from elasticsearch_dsl.connections import connections import time from blog.models import Article -from elasticsearch_dsl import Document, InnerDoc, Date, Integer, Long, Text, Object, GeoPoint +from elasticsearch_dsl import Document, InnerDoc, Date, Integer, Long, Text, Object, GeoPoint, Keyword from django.conf import settings @@ -45,18 +45,18 @@ if ELASTICSEARCH_ENABLED: class GeoIp(InnerDoc): - continent_name = Text() - country_iso_code = Text() - country_name = Text() + continent_name = Keyword() + country_iso_code = Keyword() + country_name = Keyword() location = GeoPoint() class ElapsedTimeDocument(Document): - url = Text() + url = Keyword() time_taken = Long() log_datetime = Date() useragent = Text(analyzer='ik_max_word', search_analyzer='ik_smart') - ip = Text() + ip = Keyword() geoip = Object(GeoIp, required=False) class Index: From 002f26530d4556a7abdabfcc7acbb036bb8ca15e Mon Sep 17 00:00:00 2001 From: liangliang Date: Thu, 15 Jul 2021 00:07:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 2 +- blog/static/blog/css/style.css | 15 +++++++++++++++ templates/blog/tags/breadcrumb.html | 23 +++++++++++------------ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 77b87ae..20d2423 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -34,4 +34,4 @@ jobs: linux/arm/v7 linux/arm/v6 linux/386 - tags: liangliangyy/djangoblog:latest + tags: ${{ secrets.DOCKERHUB_USERNAME }}/djangoblog:latest diff --git a/blog/static/blog/css/style.css b/blog/static/blog/css/style.css index bd6cd9f..e7f5afa 100644 --- a/blog/static/blog/css/style.css +++ b/blog/static/blog/css/style.css @@ -2438,3 +2438,18 @@ li #reply-title { font-size: small; } +.breadcrumb { + margin-bottom: 20px; + list-style: none; + border-radius: 4px; +} +.breadcrumb > li { + display: inline-block; +} +.breadcrumb > li + li:before { + color: #ccc; + content: "/\00a0"; +} +.breadcrumb > .active { + color: #777; +} \ No newline at end of file diff --git a/templates/blog/tags/breadcrumb.html b/templates/blog/tags/breadcrumb.html index 4590d85..2739d2f 100644 --- a/templates/blog/tags/breadcrumb.html +++ b/templates/blog/tags/breadcrumb.html @@ -1,14 +1,13 @@ - \ No newline at end of file +
  • + {{ title }} +
  • + \ No newline at end of file From b8e2b9af214e5d3d5abd76bc86d8fe70a0bbbb59 Mon Sep 17 00:00:00 2001 From: liangliang Date: Thu, 15 Jul 2021 00:31:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog/templatetags/blog_tags.py | 3 ++- templates/blog/tags/breadcrumb.html | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/blog/templatetags/blog_tags.py b/blog/templatetags/blog_tags.py index b9b9852..73df621 100644 --- a/blog/templatetags/blog_tags.py +++ b/blog/templatetags/blog_tags.py @@ -102,7 +102,8 @@ def load_breadcrumb(article): return { 'names': names, - 'title': article.title + 'title': article.title, + 'count': len(names) + 1 } diff --git a/templates/blog/tags/breadcrumb.html b/templates/blog/tags/breadcrumb.html index 2739d2f..67087d5 100644 --- a/templates/blog/tags/breadcrumb.html +++ b/templates/blog/tags/breadcrumb.html @@ -1,13 +1,19 @@ \ No newline at end of file + + +