Skip to content

Commit

Permalink
Improved SEO Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nilandev committed Nov 11, 2023
1 parent 0517dba commit cf65070
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
3 changes: 3 additions & 0 deletions bloggy/models/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class Page(Updatable, SeoAware):
help_text="Select publish status",
verbose_name="Publish status")

def __str__(self):
return str(self.title)

class Meta:
verbose_name = 'Page'
verbose_name_plural = 'Pages'
7 changes: 3 additions & 4 deletions bloggy/services/post_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ def set_seo_settings(post, context):
context["meta_title"] = post.meta_title

if StringUtils.is_blank(post.meta_description):
context["meta_description"] = post.meta_description
else:
context["meta_description"] = post.excerpt

else:
context["meta_description"] = post.meta_description
context['meta_keywords'] = post.meta_keywords

if post.thumbnail:
context['meta_image'] = post.thumbnail.url
# return context
8 changes: 4 additions & 4 deletions bloggy/templates/seo/seotags.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<title>{{ meta_title }} | {{ site_name }}</title>
<meta name="title" content="{{ meta_title }} | {{ site_name }}" />
{% endif %}
<link rel="dns-prefetch" href="https://stacktips.com" />
<link rel="dns-prefetch" href="{% get_settings 'SITE_URL' %}" />
<link rel="dns-prefetch" href="{{ ASSETS_DOMAIN}}" />
<meta name="description" content="{{ meta_description }}" />
{% if meta_keywords %}
Expand All @@ -30,9 +30,9 @@
<link rel="shortcut icon" type="image/x-icon" href="{% static 'media/favicon/apple-touch-icon.png' %}"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="@StackTips"/>
<meta name="twitter:creator" content="@ask_nilan"/>
<meta name="twitter:title" content="{{ title_title }}"/>
<meta name="twitter:description" content="{{ title_description }}"/>
<meta name="twitter:creator" content="@asknilan"/>
<meta name="twitter:title" content="{{ meta_title }} | {{ site_name }}"/>
<meta name="twitter:description" content="{{ meta_description }}"/>
<meta name="twitter:image" content="{{ meta_image }}"/>
<meta property="og:url" content="{{ request.build_absolute_uri }}"/>
<meta property="og:type" content="article"/>
Expand Down
9 changes: 7 additions & 2 deletions bloggy/views/posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
from bloggy.models.course import Course
from bloggy.services.post_service import get_recent_feed, set_seo_settings

@method_decorator([cache_page(settings.CACHE_TTL, key_prefix="posts"), vary_on_cookie], name='dispatch')

@method_decorator(
[cache_page(settings.CACHE_TTL, key_prefix="posts"), vary_on_cookie],
name='dispatch')
class PostListView(ListView):
model = Post
template_name = "pages/archive/posts.html"
Expand All @@ -25,7 +28,9 @@ def get_context_data(self, **kwargs):
return context


@method_decorator([cache_page(settings.CACHE_TTL, key_prefix="post_single"), vary_on_cookie], name='dispatch')
@method_decorator(
[cache_page(settings.CACHE_TTL, key_prefix="post_single"), vary_on_cookie],
name='dispatch')
class PostDetailsView(HitCountDetailView):
model = Post
count_hit = True
Expand Down
10 changes: 1 addition & 9 deletions bloggy_frontend/sass/content/_pageContent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,10 @@ ul.static-pages-menu {
}

.static-page {
//border-radius: $card-border-radius;
//background: var(--bs-card-bg);
//box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.05);
overflow: hidden;
//@extend .p-md-4;

ol, ul, dl {
margin: 0 0 1.5rem 2rem;

li {
padding: 0.35rem 0;
}
margin: 0 0 1rem 1.5rem;
}
}

Expand Down

0 comments on commit cf65070

Please sign in to comment.