mirror of
https://github.com/neocities/neocities.git
synced 2026-05-26 05:34:53 +00:00
improve meta desc for pages for search engines
This commit is contained in:
+3
-1
@@ -1,9 +1,11 @@
|
||||
get '/activity' do
|
||||
@page = params[:page] || 1
|
||||
@description = 'See recent activity from Neocities websites.'
|
||||
|
||||
halt 404 if params[:event_id]
|
||||
|
||||
if params[:tag]
|
||||
@description = "See recent activity from Neocities websites tagged #{params[:tag]}."
|
||||
query1 = Event
|
||||
.join(:sites, id: :site_id)
|
||||
.join(:sites_tags, site_id: :id)
|
||||
@@ -51,4 +53,4 @@ get '/activity' do
|
||||
@events = @pagination_dataset.all
|
||||
|
||||
erb :'activity'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ require 'base64'
|
||||
|
||||
get '/api' do
|
||||
@title = 'Developers API'
|
||||
@description = 'Use the Neocities API to upload files and manage your site programmatically.'
|
||||
erb :'api'
|
||||
end
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
get '/browse/?' do
|
||||
@page = params[:page]
|
||||
@page = 1 if @page.not_an_integer?
|
||||
@description = 'Browse Neocities websites by tags, popularity, and recent updates.'
|
||||
|
||||
if params[:tag]
|
||||
params[:tag] = params[:tag].gsub(Tag::INVALID_TAG_REGEX, '').gsub(/\s+/, '').slice(0, Tag::NAME_LENGTH_MAX)
|
||||
@title = "Sites tagged #{params[:tag]}"
|
||||
@description = "Browse Neocities websites tagged #{params[:tag]}."
|
||||
end
|
||||
|
||||
if is_education?
|
||||
@@ -135,6 +137,7 @@ end
|
||||
|
||||
get '/browse/search' do
|
||||
@title = 'Site Search'
|
||||
@description = 'Search websites hosted on Neocities.'
|
||||
|
||||
@daily_search_max_reached = daily_search_max?
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
get '/contact' do
|
||||
@show_contact_form = params[:show_contact_form] == 'yes'
|
||||
@description = 'Contact Neocities support and get help with your account or site.'
|
||||
erb :'contact'
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
get '/dmca' do
|
||||
@title = 'DMCA'
|
||||
@description = 'Submit a DMCA notice and review copyright policy information for Neocities.'
|
||||
erb :'dmca'
|
||||
end
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ get '/?' do
|
||||
end
|
||||
|
||||
@create_disabled = false
|
||||
@description = 'Create and surf awesome websites for free.'
|
||||
|
||||
erb :index, layout: :index_layout
|
||||
end
|
||||
@@ -124,46 +125,56 @@ end
|
||||
|
||||
get '/education' do
|
||||
redirect '/' if signed_in?
|
||||
@description = 'Learn how educators and students use Neocities to build websites in class.'
|
||||
erb :education, layout: :index_layout
|
||||
end
|
||||
|
||||
get '/donate' do
|
||||
@description = 'Support Neocities and help keep independent web publishing open to everyone.'
|
||||
erb :'donate'
|
||||
end
|
||||
|
||||
get '/about' do
|
||||
@description = 'Read about the Neocities mission and the team building a better web.'
|
||||
erb :'about'
|
||||
end
|
||||
|
||||
get '/terms' do
|
||||
@description = 'Review the Neocities Terms of Service.'
|
||||
erb :'terms'
|
||||
end
|
||||
|
||||
get '/privacy' do
|
||||
@description = 'Review the Neocities Privacy Policy.'
|
||||
erb :'privacy'
|
||||
end
|
||||
|
||||
get '/press' do
|
||||
@description = 'Press resources, facts, and media information about Neocities.'
|
||||
erb :'press'
|
||||
end
|
||||
|
||||
get '/legal/?' do
|
||||
@title = 'Legal Guide to Neocities'
|
||||
@description = 'Browse legal information and policy guidance for Neocities.'
|
||||
erb :'legal'
|
||||
end
|
||||
|
||||
get '/thankyou' do
|
||||
@title = 'Thank you!'
|
||||
@description = 'Thank you for supporting Neocities.'
|
||||
erb :'thankyou'
|
||||
end
|
||||
|
||||
get '/cli' do
|
||||
@title = 'Command Line Interface'
|
||||
@description = 'Use the Neocities command line tool to deploy and manage your site from terminal.'
|
||||
erb :'cli'
|
||||
end
|
||||
|
||||
get '/forgot_username' do
|
||||
@title = 'Forgot Username'
|
||||
@description = 'Recover the username for your Neocities account.'
|
||||
erb :'forgot_username'
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
get '/password_reset' do
|
||||
@title = 'Password Reset'
|
||||
@description = 'Reset your Neocities account password.'
|
||||
redirect '/' if signed_in?
|
||||
erb :'password_reset'
|
||||
end
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
get '/signin/?' do
|
||||
dashboard_if_signed_in
|
||||
@title = 'Sign In'
|
||||
@description = 'Sign in to your Neocities account.'
|
||||
erb :'signin/index'
|
||||
end
|
||||
|
||||
@@ -78,4 +79,4 @@ post '/signout' do
|
||||
require_login
|
||||
signout
|
||||
redirect '/'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,6 +15,7 @@ get '/site/:username/?' do |username|
|
||||
redirect site.uri unless site.profile_enabled
|
||||
|
||||
@title = site.title
|
||||
@description = "#{site.username}'s Neocities site profile, updates, and comments."
|
||||
|
||||
@page = params[:page]
|
||||
@page = 1 if @page.not_an_integer?
|
||||
@@ -49,6 +50,7 @@ get '/site/:username/stats' do
|
||||
not_found if @site.nil? || @site.is_banned || @site.is_deleted || (current_site && @site.is_blocking?(current_site))
|
||||
|
||||
@title = "Site stats for #{@site.host}"
|
||||
@description = "Traffic and engagement stats for #{@site.username}'s Neocities site."
|
||||
|
||||
@stats = {}
|
||||
|
||||
@@ -136,6 +138,7 @@ end
|
||||
|
||||
get '/site/:username/follows' do |username|
|
||||
@title = "Sites #{username} follows"
|
||||
@description = "See which Neocities sites #{username} follows."
|
||||
@site = Site[username: username]
|
||||
not_found if @site.nil? || @site.is_deleted || (current_site && (@site.is_blocking?(current_site) || current_site.is_blocking?(@site)))
|
||||
|
||||
@@ -147,6 +150,7 @@ end
|
||||
|
||||
get '/site/:username/followers' do |username|
|
||||
@title = "Sites that follow #{username}"
|
||||
@description = "See which Neocities sites follow #{username}."
|
||||
@site = Site[username: username]
|
||||
not_found if @site.nil? || @site.is_deleted || (current_site && (@site.is_blocking?(current_site) || current_site.is_blocking?(@site)))
|
||||
|
||||
|
||||
+4
-1
@@ -131,16 +131,19 @@ end
|
||||
|
||||
get '/site_files/allowed_types' do
|
||||
@title = 'Allowed File Types'
|
||||
@description = 'See which file types can be uploaded to Neocities sites.'
|
||||
erb :'site_files/allowed_types'
|
||||
end
|
||||
|
||||
get '/site_files/hotlinking' do
|
||||
@title = 'Hotlinking Information'
|
||||
@description = 'Learn how hotlinking works on Neocities.'
|
||||
erb :'site_files/hotlinking'
|
||||
end
|
||||
|
||||
get '/site_files/mount_info' do
|
||||
@title = 'Site Mount Information'
|
||||
@description = 'Read how to mount and manage your Neocities site files.'
|
||||
erb :'site_files/mount_info'
|
||||
end
|
||||
|
||||
@@ -176,4 +179,4 @@ post '/site_files/chat' do
|
||||
out << buffer
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,6 +14,7 @@ EOT
|
||||
end
|
||||
|
||||
get '/tutorials' do
|
||||
@description = 'Start web development tutorials on Neocities.'
|
||||
erb :'tutorials'
|
||||
end
|
||||
|
||||
|
||||
@@ -56,6 +56,17 @@ def meta_robots(newtag=nil)
|
||||
@_meta_robots
|
||||
end
|
||||
|
||||
def meta_description(new_description=nil)
|
||||
if new_description
|
||||
@_meta_description = new_description
|
||||
end
|
||||
|
||||
description = @_meta_description || @description
|
||||
return nil if description.nil? || description.strip.empty?
|
||||
|
||||
Rack::Utils.escape_html(description)
|
||||
end
|
||||
|
||||
def title
|
||||
out = "Neocities"
|
||||
return out if request.path == '/'
|
||||
|
||||
+7
-2
@@ -1,5 +1,8 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="description" content="Create and surf awesome websites for free.">
|
||||
<% description = meta_description %>
|
||||
<% if description %>
|
||||
<meta name="description" content="<%= description %>">
|
||||
<% end %>
|
||||
|
||||
<% canonical_host = @canonical_host || 'https://neocities.org' %>
|
||||
<% canonical_path = @canonical_path || request.fullpath %>
|
||||
@@ -8,7 +11,9 @@
|
||||
<meta property="og:title" content="Neocities">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:image" content="<%= canonical_host %>/img/neocities-front-screenshot.jpg">
|
||||
<meta property="og:description" content="Create and surf awesome websites for free.">
|
||||
<% if description %>
|
||||
<meta property="og:description" content="<%= description %>">
|
||||
<% end %>
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="/img/favicon.png">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user