Skip to content

Instantly share code, notes, and snippets.

View tonyfrenzy's full-sized avatar
💭
Upskilling 💻

tony tonyfrenzy

💭
Upskilling 💻
View GitHub Profile
@tonyfrenzy
tonyfrenzy / app.blade.php
Last active August 31, 2019 20:51
The base template - Scaffolding A Dynamic Website With Basic Onpage SEO
<!--
Initially 'app_raw.blade.php' (see the next code) now broken into 3 templates:
i. app.blade.php (will yield contents of the optmization)
ii. _metas.blade.php (main section for the optimization)
iii. _assets.blade.php (not important in our case)
-->
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@include('layouts._metas')
@tonyfrenzy
tonyfrenzy / _metas.blade.php
Last active September 5, 2019 13:08
Core of the dynamic optimization is the _metas template - Scaffolding A Dynamic Website With Basic Onpage SEO - Visit https://medium.com/@tonyfrenzy/link-preview-customizations-on-dynamic-websites-8b571c58ffe7
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 1. General Tags -->
<title>{{ config('app.name') }}</title>
<meta name="description" content="@yield('meta-description')">
<meta name="keywords" content="@yield('meta-keywords')">
<!-- 2. Microformat Markup -->
@tonyfrenzy
tonyfrenzy / post.blade.php
Last active August 31, 2019 10:56
Scaffolding A Dynamic Website With Basic Onpage SEO - For proper rendering of dynamic contents appropriate variables must be defined within the relevant pages, then passed down to the _meta.blade.php template for selective rendering.
@extends('layouts.app')
@section('title', $post->title)
@section('meta-description', $post->meta_description) // or $post->metaDescription() if generated from a method
@section('meta-keywords', $post->meta_keywords) // or $post->metaKeywords()
@section('meta-image', $post->meta_image) // or $post->metaImage()
@section('meta-og-url', route('posts.show', $post->slug))
@section('author-tw-handle', $post->user->twitterHandle)
@section('content')
The variables and constants listed below were referenced witihn the _metas template.
Variables (to be supplied on the relevant pages)
- @yield('title')
- @yield('meta-description')
- @yield('meta-keywords')
- @yield('meta-image')
- @yield('meta-og_url')
- @yield('author-tw-handle')
@tonyfrenzy
tonyfrenzy / generate_dynamic_variables.php
Last active August 31, 2019 11:08
This is a PHP Trait but can be formed from within the model
<?php
namespace App\Traits\ViewRepos;
use Illuminate\Http\Request;
/**
* Given a post has properties such as County, State, Country.
* You may want to captivate audience from a particular locality
* with descriptions and keywords as dynamic the methods below:
*/
trait PostViewFragment
NB: The values below should be generated dynamically but for our purpose this will work just fine.
To be supplied within individual page templates
--------------------------------------------------------
KEYs | VALUES
---------------------+----------------------------------
- title = "Link Preview Customizations On Dynamic Websites — A Basic Onpage SEO for Web Developers"
- meta-description = "Learn to customize link previews for your dynamic website."
- meta-keywords = "SEO, link preview, link preview optimization, SEO for web developers"
- meta-image = "https://cdn-images-1.medium.com/max/1200/1*cTq1xTowzbV37I8KlKhJGA.jpeg"
- meta-og_url = "https://medium.com/@tonyfrenzy/scaffolding-a-dynamic-website-with-basic-onpage-seo-web-developers-8b571c58ffe7"
@tonyfrenzy
tonyfrenzy / medium_post.blade.php
Created August 31, 2019 17:50
Given this page is dynamically created
@extends('layouts.app')
@section('title', 'Link Preview Customizations On Dynamic Websites — A Basic Onpage SEO for Web Developers')
@section('meta-description', 'Learn to customize link previews for your dynamic website.')
@section('meta-keywords', 'SEO, link preview, link preview optimization, SEO for web developers')
@section('meta-image', 'https://cdn-images-1.medium.com/max/1200/1*cTq1xTowzbV37I8KlKhJGA.jpeg')
@section('meta-og-url', 'https://medium.com/@tonyfrenzy/scaffolding-a-dynamic-website-with-basic-onpage-seo-web-developers-8b571c58ffe7')
@section('author-tw-handle', '@_tonyfrenzy')
@section('content')
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 1. General tags -->
<title>Medium</title>
<meta name="description" content="Learn to customize link previews for your dynamic website.">
<meta name="keywords" content="SEO, link preview, link preview optimization, SEO for web developers">
<!-- 2. Schema.org Microformat Markup -->
@tonyfrenzy
tonyfrenzy / microdata_page.html
Created September 11, 2019 17:21
A page marked up with Microdata - Structured Data: To Use JSON-LD or Microdata?
<section itemscope itemtype="http://schema.org/Person">
Hello, my name is <span itemprop="name">John Doe</span>, I am a <span itemprop="jobTitle">graduate research assistant</span> at the <span itemprop="affiliation">University of Dreams</span>. My friends call me <span itemprop="additionalName">Johnny</span>.
You can visit my homepage at <a href="http://www.JohnnyD.com" itemprop="url">www.JohnnyD.com</a>.
<section itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">I live at <span itemprop="streetAddress">1234 Peach Drive</span>, <span itemprop="addressLocality">Warner Robins</span>,
<span itemprop="addressRegion">Georgia</span>.
</section>
</section>
@tonyfrenzy
tonyfrenzy / jsonld_page.html
Last active September 11, 2019 19:20
A page marked up with JSON-LD - Structured Data: To Use JSON-LD or Microdata?
<html>
<head>
<!-- Schema code seperated from HTML code -->
<script type="application/ld+json">
{
"@context":"https://schema.org",
"@type": "Person",
"name": "John Doe",
"additionalName": "Johnny",
"jobTitle": "graduate research assistant",