Try to improve SEO

This commit is contained in:
Zach Latta 2025-10-22 19:18:06 +00:00
parent 75e0fe1eea
commit 11948a33cc
9 changed files with 154 additions and 21 deletions

View file

@ -180,10 +180,10 @@ class Api::Hackatime::V1::HackatimeController < ApplicationController
category_durations.map do |name, duration|
name = name.presence || "unknown"
name = case category
when "editor" then ApplicationController.helpers.display_editor_name(name)
when "operating_system" then ApplicationController.helpers.display_os_name(name)
when "language" then ApplicationController.helpers.display_language_name(name)
else name
when "editor" then ApplicationController.helpers.display_editor_name(name)
when "operating_system" then ApplicationController.helpers.display_os_name(name)
when "language" then ApplicationController.helpers.display_language_name(name)
else name
end
percent = ((duration / total_duration) * 100).round(2)
hours = duration.to_i / 3600

View file

@ -158,12 +158,12 @@ class DocsController < ApplicationController
.strip
description.length > 155 ? "#{description[0..155]}..." : description
else
"#{title} - Complete documentation for Hackatime, the free and open source WakaTime alternative"
"#{title} - Complete documentation for Hackatime, the free and open source time tracker by Hack Club"
end
end
def generate_doc_keywords(doc_path, title)
base_keywords = %w[hackatime wakatime alternative time tracking coding documentation]
base_keywords = %w[hackatime hack club open source tracker time tracking coding documentation]
# Add path-specific keywords
path_keywords = case doc_path

View file

@ -84,6 +84,16 @@ class StaticPagesController < ApplicationController
render :minimal_login, layout: "doorkeeper/application"
end
def what_is_hackatime
@page_title = "What is Hackatime? - Free Coding Time Tracker"
@meta_description = "Hackatime is a free, open-source coding time tracker built by Hack Club for high school students. Track your programming time across 75+ editors and see your coding statistics."
@meta_keywords = "what is hackatime, hackatime definition, hack club time tracker, coding time tracker, programming statistics"
@og_title = @page_title
@og_description = @meta_description
@twitter_title = @page_title
@twitter_description = @meta_description
end
def mini_leaderboard
use_timezone_leaderboard = current_user&.default_timezone_leaderboard
@ -235,7 +245,7 @@ class StaticPagesController < ApplicationController
@page_title = title
@meta_description = desc
@meta_keywords = "coding time tracker, programming stats, wakatime alternative, free time tracking, code statistics, high school programming, coding analytics"
@meta_keywords = "coding time tracker, programming stats, open source time tracker, hack club coding tracker, free time tracking, code statistics, high school programming, coding analytics"
@og_title = title
@og_description = desc
@twitter_title = title
@ -263,7 +273,7 @@ class StaticPagesController < ApplicationController
result[filter] = group_by_time.sort_by { |k, v| v }
.reverse.map(&:first)
.compact_blank
.map { |k|
.map { |k|
if filter == :editor
ApplicationController.helpers.display_editor_name(k)
elsif filter == :operating_system
@ -338,11 +348,11 @@ class StaticPagesController < ApplicationController
.first(10)
.map { |k, v|
label = case filter
when :editor then ApplicationController.helpers.display_editor_name(k)
when :operating_system then ApplicationController.helpers.display_os_name(k)
when :language then ApplicationController.helpers.display_language_name(k)
when :category then k
else k.capitalize
when :editor then ApplicationController.helpers.display_editor_name(k)
when :operating_system then ApplicationController.helpers.display_os_name(k)
when :language then ApplicationController.helpers.display_language_name(k)
when :category then k
else k.capitalize
end
[ label, v ]
}

View file

@ -142,7 +142,7 @@ module ApplicationHelper
def display_editor_name(editor)
return "Unknown" if editor.blank?
case editor.downcase
when "vscode" then "VS Code"
when "pycharm" then "PyCharm"
@ -161,7 +161,7 @@ module ApplicationHelper
def display_os_name(os)
return "Unknown" if os.blank?
case os.downcase
when "darwin" then "macOS"
when "macos" then "macOS"
@ -171,7 +171,7 @@ module ApplicationHelper
def display_language_name(language)
return "Unknown" if language.blank?
case language.downcase
when "typescript" then "TypeScript"
when "javascript" then "JavaScript"

View file

@ -8,7 +8,7 @@
<meta name="color-scheme" content="dark">
<!-- SEO Meta Tags -->
<meta name="description" content="<%= @meta_description || content_for(:meta_description) || 'Track your coding time easily with Hackatime. A free tool to see how much time you spend programming in different languages and editors. Better than WakaTime and totally free!' %>">
<meta name="description" content="<%= @meta_description || content_for(:meta_description) || 'Free and open-source coding time tracker built by Hack Club. Track your time across 75+ editors.' %>">
<meta name="keywords" content="<%= @meta_keywords || content_for(:meta_keywords) || 'coding time tracker, programming stats, wakatime alternative, free time tracking, code statistics, developer analytics, programming time, coding productivity' %>">
<meta name="author" content="Hack Club">
<meta name="robots" content="index, follow">
@ -20,7 +20,7 @@
<!-- Open Graph Tags -->
<meta property="og:title" content="<%= @og_title || content_for(:og_title) || @page_title || content_for(:title) || 'Hackatime - Free Coding Time Tracker' %>">
<meta property="og:description" content="<%= @og_description || content_for(:og_description) || @meta_description || content_for(:meta_description) || 'Track your coding time easily with Hackatime. A free tool to see how much time you spend programming. Better than WakaTime!' %>">
<meta property="og:description" content="<%= @og_description || content_for(:og_description) || @meta_description || content_for(:meta_description) || 'Free and open-source coding time tracker built by Hack Club. Track your time across 75+ editors.' %>">
<meta property="og:url" content="<%= content_for(:og_url) || request.original_url %>">
<meta property="og:type" content="<%= content_for(:og_type) || 'website' %>">
<meta property="og:image" content="<%= content_for(:og_image) || asset_path('favicon.png') %>">
@ -34,7 +34,7 @@
<meta name="twitter:site" content="@hackclub">
<meta name="twitter:creator" content="@hackclub">
<meta name="twitter:title" content="<%= @twitter_title || content_for(:twitter_title) || @page_title || content_for(:title) || 'Hackatime - Free Coding Time Tracker' %>">
<meta name="twitter:description" content="<%= @twitter_description || content_for(:twitter_description) || @meta_description || content_for(:meta_description) || 'Track your coding time easily with Hackatime. A free tool to see how much time you spend programming. Better than WakaTime!' %>">
<meta name="twitter:description" content="<%= @twitter_description || content_for(:twitter_description) || @meta_description || content_for(:meta_description) || 'Free and open-source coding time tracker built by Hack Club. Track your time across 75+ editors.' %>">
<meta name="twitter:image" content="<%= content_for(:twitter_image) || asset_path('favicon.png') %>">
<%= csrf_meta_tags %>
@ -54,11 +54,22 @@
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "Hackatime",
"alternateName": "Hack Club Hackatime",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Any",
"description": "Track your coding time easily with Hackatime. A free tool to see how much time you spend programming in different languages and editors.",
"url": "https://hackatime.hackclub.com",
"downloadUrl": "https://hackatime.hackclub.com",
"sameAs": [
"https://github.com/hackclub/hackatime",
"https://hackatime.hackclub.com/docs"
],
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock"
},
"author": {
"@type": "Organization",
"name": "Hack Club",
@ -95,6 +106,17 @@
}
</script>
<!-- WebSite Schema -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Hackatime",
"alternateName": "Hack Club Hackatime",
"url": "https://hackatime.hackclub.com"
}
</script>
<!-- FAQ Schema for Homepage -->
<% if request.path == "/" %>
<script type="application/ld+json">
@ -125,6 +147,14 @@
"@type": "Answer",
"text": "Hackatime is free and open source, while WakaTime has paid plans. Hackatime gives you all features for free and you can host it yourself."
}
},
{
"@type": "Question",
"name": "Is Hackatime the same as WakaTime?",
"acceptedAnswer": {
"@type": "Answer",
"text": "No. Hackatime is a separate, independent open-source project built by Hack Club. While both track coding time, Hackatime is completely free and designed for high school students in the Hack Club community."
}
}
]
}

View file

@ -42,6 +42,11 @@
Docs
<% end %>
</div>
<div>
<%= link_to "/what-is-hackatime", class: "block px-2 py-1 rounded-lg transition #{current_page?('/what-is-hackatime') ? 'bg-primary/50 text-primary' : 'hover:bg-[#23272a]'}", data: { action: "click->nav#clickLink" } do %>
What is Hackatime?
<% end %>
</div>
<% end %>
<% if current_user %>
<div>

View file

@ -0,0 +1,87 @@
<% content_for :head do %>
<!-- Article Schema -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "What is Hackatime?",
"description": "Hackatime is a free, open-source coding time tracker built by Hack Club for high school students. Track your programming time across 75+ editors and see your coding statistics.",
"url": "https://hackatime.hackclub.com/what-is-hackatime",
"datePublished": "2025-01-01",
"dateModified": "2025-01-01",
"author": {
"@type": "Organization",
"name": "Hack Club",
"url": "https://hackclub.com"
},
"publisher": {
"@type": "Organization",
"name": "Hack Club",
"url": "https://hackclub.com"
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://hackatime.hackclub.com/what-is-hackatime"
},
"about": {
"@type": "SoftwareApplication",
"name": "Hackatime",
"description": "Free and open source coding time tracker by Hack Club"
}
}
</script>
<% end %>
<div class="container">
<div class="max-w-4xl mx-auto">
<h1 class="text-4xl font-bold mb-6 text-center">
What is <span class="text-primary">Hackatime</span>?
</h1>
<div class="bg-dark rounded-lg p-8 mb-8">
<p class="text-lg mb-6">
<strong class="text-primary">Hackatime</strong> is a free, open-source coding time tracker built by <a href="https://hackclub.com" target="_blank" class="text-primary hover:text-red underline">Hack Club</a> for high school students and developers who want to understand their programming habits.
</p>
<p class="text-lg mb-6">
Unlike other time tracking tools, <strong>Hackatime</strong> is completely free and designed specifically for the Hack Club community. It helps you see exactly how much time you spend coding, which programming languages you use most, and which editors you prefer.
</p>
<h2 class="text-2xl font-semibold text-primary mb-4">How Hackatime Works</h2>
<p class="text-lg mb-6">
<strong>Hackatime</strong> tracks your coding activity automatically by monitoring when you're actively typing in your code editor. It works with over 75 different editors including VS Code, JetBrains IDEs, vim, emacs, and many more.
</p>
<h2 class="text-2xl font-semibold text-primary mb-4">Why Hackatime Exists</h2>
<p class="text-lg mb-6">
<strong>Hackatime</strong> was created because Hack Club believes that the more time you spend making things, the better you get at building cool projects. By tracking your coding time, you can see your progress and stay motivated to keep building.
</p>
<h2 class="text-2xl font-semibold text-primary mb-4">Key Features of Hackatime</h2>
<ul class="list-disc list-inside text-lg mb-6 space-y-2">
<li><strong>Completely free</strong> - No paid plans or hidden costs</li>
<li><strong>Open source</strong> - You can see the code and contribute</li>
<li><strong>Works offline</strong> - Tracks your time even without internet</li>
<li><strong>Real-time stats</strong> - See your coding activity as it happens</li>
<li><strong>Community leaderboards</strong> - Compare with other Hack Clubbers</li>
<li><strong>Privacy-focused</strong> - Minimal data is collected for time tracking. File contents are never sent to our servers or stored.</li>
</ul>
<h2 class="text-2xl font-semibold text-primary mb-4">Getting Started with Hackatime</h2>
<p class="text-lg mb-6">
To start using <strong>Hackatime</strong>, simply sign in with your Hack Club Slack account or email. Once you're logged in, install the editor plugin for your preferred code editor and start coding. <strong>Hackatime</strong> will automatically begin tracking your time.
</p>
<div class="text-center mt-8">
<%= link_to "Get Started with Hackatime", root_path, class: "inline-block bg-primary text-white font-bold px-8 py-3 rounded-lg hover:bg-red-600 transition-colors duration-200" %>
</div>
</div>
<div class="text-center text-gray-400 text-sm">
<p>
<strong>Hackatime</strong> is built and maintained by the Hack Club community.
<%= link_to "Learn more about Hack Club", "https://hackclub.com", target: "_blank", class: "text-primary hover:text-red underline" %>.
</p>
</div>
</div>
</div>

View file

@ -69,6 +69,7 @@ Rails.application.routes.draw do
end
get "/minimal_login", to: "static_pages#minimal_login", as: :minimal_login
get "/what-is-hackatime", to: "static_pages#what_is_hackatime"
# Auth routes
get "/auth/slack", to: "sessions#new", as: :slack_auth

View file

@ -1,6 +1,6 @@
# Hackatime Quick Start Guide - Free WakaTime Alternative
# Hackatime Quick Start Guide - Free Time Tracker
Get up and running with Hackatime in under 5 minutes! Start tracking your coding time across 40+ editors with our free, open source WakaTime alternative.
Get up and running with Hackatime in under 5 minutes! Start tracking your coding time across 40+ editors with our free, open source time tracker built by Hack Club.
## What is Hackatime?