Skip to content

Instantly share code, notes, and snippets.

@AltanS
AltanS / .php
Created November 9, 2023 12:32
YoastSEO WordPress - accessing values in PHP code
<?php
YoastSEO()->meta->for_post($post->ID)->title;
YoastSEO()->meta->for_post($post->ID)->canonical;
// Other values with their default values
// 'canonical' => null,
// 'title' => null,
// 'description' => null,
// 'open_graph_title' => null,
// 'open_graph_image' => 'open_graph_image',
@AltanS
AltanS / checker.html
Created April 7, 2020 13:26
title length prismic bookmarklet
<html>
<head>
<title>Check Prismic SEO Length Bookmarklet</title>
</head>
<body>
<div>
<h1>Drag this button to your bookmarks</h1>
<button><a id="bookmarklet" href="" title="Check SEO Length">Check SEO length</a></button>
<p>Then press the button on the editor page</p>
</div>
@AltanS
AltanS / server_stats.sh
Created July 19, 2017 17:15
Send Googlebot requests per day by status code into Slack - For NGINX web servers
yesterdaysTimestamp=$(date -d "yesterday 13:00" +'%d/%b/%Y')
# date is expected to be passed in the following format 18/Jul/2017
siteName="example.com"
logPath="/srv/www/$siteName/logs/access.log"
# Depending on the size of the access log you might have to add * to include multiple files
# To grep through .gz files use zgrep instead of grep
# grep -v 'onpage' excludes requests from onpage bot, add pipes to exclude other unwanted bots using Googlebot as their UserAgent
# Prepare results
googleBot=$(grep 'Googlebot' $logPath | grep $yesterdaysTimestamp | grep -v 'onpage' | wc -l)