From 6bd0df1f34418e7f61c10f2a3e9b0f76e5f50734 Mon Sep 17 00:00:00 2001 From: Konstantin Kostov Date: Fri, 29 Mar 2024 18:43:38 +0100 Subject: [PATCH] Add bump version, add robots.txt --- Makefile | 8 ++++++-- base/templates/robots.txt | 33 +++++++++++++++++++++++++++++++++ bump_version.sh | 16 ++++++++++++++++ iamkonstantin_web/urls.py | 3 ++- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 base/templates/robots.txt create mode 100644 bump_version.sh diff --git a/Makefile b/Makefile index 85dc960..5c5cad2 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,14 @@ .PHONY: help build publish +VERSION = 1.0.27 help: @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' build: - @docker build -t code.headbright.be/konstantin/iamkonstantin:1.0.24 . + @docker build -t code.headbright.be/konstantin/iamkonstantin:$(VERSION) . publish: - @docker push code.headbright.be/konstantin/iamkonstantin:1.0.24 + @docker push code.headbright.be/konstantin/iamkonstantin:$(VERSION) +bump: + @bash ./bump_version.sh +upgrade: bump build publish \ No newline at end of file diff --git a/base/templates/robots.txt b/base/templates/robots.txt new file mode 100644 index 0000000..dc8750d --- /dev/null +++ b/base/templates/robots.txt @@ -0,0 +1,33 @@ +User-agent: * +Allow: /*?v +Disallow: /calendar/action* +Disallow: /events/action* +Disallow: /*? +Crawl-delay: 3 + +User-agent: AdsBot-Google +User-agent: Amazonbot +User-agent: anthropic-ai +User-agent: Applebot +User-agent: AwarioRssBot +User-agent: AwarioSmartBot +User-agent: Bytespider +User-agent: CCBot +User-agent: ChatGPT-User +User-agent: ClaudeBot +User-agent: Claude-Web +User-agent: cohere-ai +User-agent: DataForSeoBot +User-agent: FacebookBot +User-agent: Google-Extended +User-agent: GoogleOther +User-agent: GPTBot +User-agent: ImagesiftBot +User-agent: magpie-crawler +User-agent: omgili +User-agent: omgilibot +User-agent: peer39_crawler +User-agent: peer39_crawler/1.0 +User-agent: PerplexityBot +User-agent: YouBot +Disallow: / \ No newline at end of file diff --git a/bump_version.sh b/bump_version.sh new file mode 100644 index 0000000..cd8b6ba --- /dev/null +++ b/bump_version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Read the current version from the Makefile +current_version=$(sed -n 's/^VERSION = \(.*\)/\1/p' Makefile) + +# Split the version into an array using '.' as the delimiter +IFS='.' read -ra version_parts <<< "$current_version" + +# Increment the last part of the version +((version_parts[-1]++)) + +# Join the version parts back together with '.' as the delimiter +new_version=$(IFS=. ; echo "${version_parts[*]}") + +# Replace the old version with the new one in the Makefile +sed -i "" "s/^VERSION = $current_version/VERSION = $new_version/g" Makefile \ No newline at end of file diff --git a/iamkonstantin_web/urls.py b/iamkonstantin_web/urls.py index 95df8cf..6816377 100644 --- a/iamkonstantin_web/urls.py +++ b/iamkonstantin_web/urls.py @@ -1,6 +1,7 @@ from django.conf import settings from django.urls import include, path from django.contrib import admin +from django.views.generic.base import TemplateView from wagtail.admin import urls as wagtailadmin_urls from wagtail import urls as wagtail_urls @@ -17,9 +18,9 @@ urlpatterns = [ path("search/", search_views.search, name="search"), path("blog/feed/", RssBlogFeed(), name="blog_feed"), path('sitemap.xml', sitemap), + path('robots.txt', TemplateView.as_view(template_name="robots.txt", content_type="text/plain")) ] - if settings.DEBUG: from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns