Skip to content

Instantly share code, notes, and snippets.

@henshaw
henshaw / disallow-genai-bots.txt
Last active March 18, 2024 06:23
Disallow all pages from being trained for LLMs by all major GenAI bots
User-agent: AdsBot-Google
Disallow: /
User-agent: Amazonbot
Disallow: /
User-agent: Anthropic-ai
Disallow: /
User-agent: AwarioRssBot
Disallow: /
User-agent: AwarioSmartBot
Disallow: /
@henshaw
henshaw / google-web-cache.js
Created January 29, 2024 04:09
Bookmarklet URL for viewing a web page in Google's Web Cache
javascript: window.location = 'https://webcache.googleusercontent.com/search?q=cache:' + window.location.protocol + '//' + window.location.hostname + window.location.pathname;
@henshaw
henshaw / hide-label.css
Last active January 25, 2024 23:32
CSS for hiding the WordPress Search Form Label while maintaining accessiblity (not using display:none;)
.screen-reader-text:not(:focus):not(:active) {
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
clip-path: inset(50%);
width: 1px;
height: 1px;
white-space:nowrap;
}
@henshaw
henshaw / close.html
Last active January 14, 2024 03:06
JavaScript and HTML used to show and hide Close icon
<!-- JS for displaying and hiding "Close" icon -->
<script>
function navopen() {
var x = document.getElementById("close");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
@henshaw
henshaw / breadcrumblist.json
Last active January 14, 2024 03:05
BreadcrumbList Schema example with emoji
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"item":
{
@henshaw
henshaw / open-graph-image.php
Created January 3, 2024 00:02
Open Graph Thumbnail Images for WordPress
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 79, true );
add_image_size( 'single-post-thumbnail', 1200, 630 );
}
@henshaw
henshaw / remove-yoast-schema.php
Created January 3, 2024 00:01
Remove Yoast Schema output from WordPress
function remove_yoast_json($data){
$data = array();
return $data;
}
add_filter('wpseo_json_ld_output', 'remove_yoast_json', 10, 1);
@henshaw
henshaw / author-bio.php
Created January 3, 2024 00:00
Add a short author bio at the end of the articles
<?php echo get_the_author_meta('description'); ?>
@henshaw
henshaw / article-timestamp.php
Created January 2, 2024 23:59
Dynamically inserting the article timestamp in WordPress
<time datetime="<?php the_time('c'); ?>"><?php the_time('m/j/Y'); ?> <?php the_time('g:ia T'); ?></time>
@henshaw
henshaw / author-url.php
Created January 2, 2024 23:57
Dynamically inserting the author’s URL in WordPress
<a href="<?php echo get_the_author_meta('user_url'); ?>"><?php the_author(); ?></a>