improve seo tagging, update nginx config file

This commit is contained in:
r888888888
2016-05-23 17:05:23 -07:00
parent a90750f5e1
commit ba65ec3e18
3 changed files with 9 additions and 2 deletions

View File

@@ -121,7 +121,7 @@ class Post < ActiveRecord::Base
end
def seo_tags
@seo_tags ||= humanized_essential_tag_string.gsub(/[^a-z0-9]+/, "-").gsub(/(^-+)|(-+$)/, "")
@seo_tags ||= humanized_essential_tag_string.gsub(/[^a-z0-9]+/, "-").gsub(/(?:^-+)|(?:-+$)/, "").gsub(/-{2,}/, "-")
end
def preview_file_url

View File

@@ -396,6 +396,7 @@ module Danbooru
def addthis_key
end
# include essential tags in image urls (requires nginx/apache rewrites)
def enable_seo_post_urls
false
end

View File

@@ -14,11 +14,17 @@ server {
expires max;
break;
}
#location /ssd {
# rewrite ^/ssd(.*)$ $1;
#}
location /data {
valid_referers none __hostname__;
# if you want to block hotlinking
# valid_referers none __hostname__ ~\.google\. ~\.bing\. ~\.yahoo\.;
if ($invalid_referer) {
return 403;
}
rewrite ^/data/sample/--.+?--(.+) /data/sample/$1 last;
rewrite ^/data/--.+?--(.+) /data/$1 last;
expires max;
break;
}