diff options
author | Ugnich Anton | 2014-07-25 17:56:18 +0700 |
---|---|---|
committer | Ugnich Anton | 2014-07-25 17:56:18 +0700 |
commit | a0a9e4151991111886d88b565fda7db9fba1dfd8 (patch) | |
tree | 7f8ff1a97b2830f584d7c9d616997b1906422966 /src/java | |
parent | 2b9c93ac6d216b67e95ccc0cfb30bc5f58c9744a (diff) |
SEO, advertising
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/com/juick/http/www/Discover.java | 12 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Home.java | 10 | ||||
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 4 | ||||
-rw-r--r-- | src/java/com/juick/http/www/User.java | 19 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 2 |
5 files changed, 30 insertions, 17 deletions
diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java index ca78f41e..201139c4 100644 --- a/src/java/com/juick/http/www/Discover.java +++ b/src/java/com/juick/http/www/Discover.java @@ -17,6 +17,7 @@ */ package com.juick.http.www; +import com.juick.server.AdsQueries; import com.juick.server.MessagesQueries; import com.juick.server.TagQueries; import java.io.IOException; @@ -90,7 +91,16 @@ public class Discover { out.println("<section id=\"content\">"); if (mids.size() > 0) { - PageTemplates.printMessages(out, sql, null, mids, visitor, visitor == null ? 2 : 3, 0); + int vuid = visitor != null ? visitor.UID : 0; + int ad_mid = AdsQueries.getAdMID(sql, vuid); + if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) { + mids.add(0, ad_mid); + AdsQueries.logAdMID(sql, vuid, ad_mid); + } else { + ad_mid = 0; + } + + PageTemplates.printMessages(out, sql, null, mids, visitor, visitor == null ? 2 : 3, ad_mid); } if (mids.size() >= 20) { diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java index f54128f4..8b4ec6a6 100644 --- a/src/java/com/juick/http/www/Home.java +++ b/src/java/com/juick/http/www/Home.java @@ -94,7 +94,7 @@ public class Home { PrintWriter out = response.getWriter(); try { String head = ""; - if (paramBefore > 0) { + if (paramBefore > 0 || paramShow != null) { head = "<meta name=\"robots\" content=\"noindex\"/>"; } PageTemplates.pageHead(out, title, head); @@ -122,12 +122,12 @@ public class Home { if (mids.size() > 0) { int ad_mid = 0; - if (visitor != null && (paramShow == null || paramShow.equals("top") || paramShow.equals("all"))) { - ad_mid = AdsQueries.getAdMID(sql, visitor.UID); - + if (paramShow == null || paramShow.equals("top") || paramShow.equals("all")) { + int vuid = visitor != null ? visitor.UID : 0; + ad_mid = AdsQueries.getAdMID(sql, vuid); if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) { mids.add(0, ad_mid); - AdsQueries.logAdMID(sql, visitor.UID, ad_mid); + AdsQueries.logAdMID(sql, vuid, ad_mid); } else { ad_mid = 0; } diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index c64f99dd..da4c0b81 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -73,7 +73,7 @@ public class PageTemplates { out.println(" <div id=\"logo\"><a href=\"/\">Juick</a></div>"); out.print(" <nav id=\"global\"><ul>"); out.print("<li><a href=\"/\">Популярные</a></li>"); - out.print("<li><a href=\"/?show=all\">Все сообщения</a></li>"); + out.print("<li><a href=\"/?show=all\" rel=\"nofollow\">Все сообщения</a></li>"); out.println("</ul></nav>"); out.print(" <div id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"Поиск\""); if (search != null) { @@ -498,7 +498,7 @@ public class PageTemplates { if (user == null) { tags = msg.Tags.isEmpty() ? "" : formatTags(msg.Tags, null); } else { - tags = msg.Tags.isEmpty() ? "" : formatTags(msg.Tags, msg.User); + tags = msg.Tags.isEmpty() ? "" : formatTags(msg.Tags, null); //msg.User); } if (msg.ReadOnly) { tags += " *readonly"; diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 8723a7e9..83601ade 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -120,7 +120,7 @@ public class User { String head = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + user.UName + "\" href=\"//rss.juick.com/" + user.UName + "/blog\"/>"; if (paramTag != null && TagQueries.getTagNoIndex(sql, paramTag.TID)) { head += "<meta name=\"robots\" content=\"noindex,nofollow\"/>"; - } else if (paramBefore > 0) { + } else if (paramBefore > 0 || paramShow != null) { head += "<meta name=\"robots\" content=\"noindex\"/>"; } PageTemplates.pageHead(out, title, head); @@ -170,7 +170,8 @@ public class User { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "Теги " + user.UName, null); + String head = "<meta name=\"robots\" content=\"noindex,nofollow\"/>"; + PageTemplates.pageHead(out, "Теги " + user.UName, head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -195,7 +196,8 @@ public class User { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "Подписки " + user.UName, null); + String head = "<meta name=\"robots\" content=\"noindex\"/>"; + PageTemplates.pageHead(out, "Подписки " + user.UName, head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -243,7 +245,8 @@ public class User { response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); try { - PageTemplates.pageHead(out, "Читатели " + user.UName, null); + String head = "<meta name=\"robots\" content=\"noindex\"/>"; + PageTemplates.pageHead(out, "Читатели " + user.UName, head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -317,14 +320,14 @@ public class User { } out.println(" <ul>"); out.println(" <li><a href=\"./\">Блог</a></li>"); - out.println(" <li><a href=\"./?show=recomm\">Рекомендации</a></li>"); - out.println(" <li><a href=\"./?show=photos\">Фотографии</a></li>"); + out.println(" <li><a href=\"./?show=recomm\" rel=\"nofollow\">Рекомендации</a></li>"); + out.println(" <li><a href=\"./?show=photos\" rel=\"nofollow\">Фотографии</a></li>"); out.println(" </ul>"); out.println(" <hr/>"); out.println(" <form action=\"./\">"); out.println(" <p><input type=\"text\" name=\"search\" class=\"inp\" placeholder=\"Поиск\"/></p>"); out.println(" </form>"); - out.println(" <p class=\"tags\">" + pageUserTags(sql, user, visitor, 20) + "<a href=\"./tags\">...</a></p>"); + out.println(" <p class=\"tags\">" + pageUserTags(sql, user, visitor, 20) + "<a href=\"./tags\" rel=\"nofollow\">...</a></p>"); out.println(" <hr/>"); out.println(" <div id=\"ustats\"><ul>"); out.println(" <li><a href=\"./friends\">Я читаю: " + UserQueries.getStatsIRead(sql, user.UID) + "</a></li>"); @@ -393,7 +396,7 @@ public class User { for (int i = 0; i < cnt; i++) { String tag = Utils.encodeHTML(tags[i].Name); try { - tag = "<a href=\"./?tag=" + URLEncoder.encode(tags[i].Name, "UTF-8") + "\" title=\"" + tags[i].UsageCnt + "\">" + tag + "</a>"; + tag = "<a href=\"./?tag=" + URLEncoder.encode(tags[i].Name, "UTF-8") + "\" title=\"" + tags[i].UsageCnt + "\" rel=\"nofollow\">" + tag + "</a>"; } catch (UnsupportedEncodingException e) { } diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index c2d7cb14..46242e2b 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -98,7 +98,7 @@ public class UserThread { public static com.juick.Message printMessage(PrintWriter out, Connection sql, com.juick.Message msg, com.juick.User visitor) { msg.VisitorCanComment = visitor != null; - String tags = (msg.Tags.isEmpty()) ? "" : PageTemplates.formatTags(msg.Tags, msg.User); + String tags = (msg.Tags.isEmpty()) ? "" : PageTemplates.formatTags(msg.Tags, null); //msg.User); if (msg.ReadOnly) { tags += " *readonly"; msg.VisitorCanComment = false; |