bugs and shop updates with strapi
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
oDinZu 2022-11-02 21:41:00 -04:00
parent 01f8c5a859
commit 25751900ed
47 changed files with 341 additions and 74 deletions

View File

@ -50,21 +50,21 @@ feed:
- devops
# ===================================================================================
# teh API dashboard configuration
# the API dashboard configuration
api:
# ecommerce integration with Stripe
# Ecommerce integration with Stripe
stripe:
# The Stripe Jekyll configuration
enabled: true # sometimes we don't need ecommerce integration; defaults to false
reset_stripe_db: false # when set true, it will delete all remote Stripe products and resubmit the products from CMS interface; caution! used for cleaning a Stripe db.
# TODO? reset_stripe_db: false # when set true, it will delete all remote Stripe products and resubmit the products from CMS interface; caution! used for cleaning a Stripe db.
# uri format: [endpoint]+[endpoint_ext]+[endpoint_param]
endpoint: https://dash.sharpetronics.com # url to api; no trailing slash
endpoint_ext: /api/ # (optional) the extension of endpoint e.g. https://www.example.com/api/
endpoint_param: ?populate=* # (optional) e.g. populate all json data; does not affect endpoint_uploads.
endpoint_param: ?populate=deep # (optional) e.g. populate all json data; does not affect endpoint_uploads.
endpoint_uploads: uploads # optional, no use at the moment; the location of all media files on api; this is required for downloading images
local_media_dir: uploads/ # where to cache the images
local_media_dir: uploads/ # where to cache the images # TODO add more organization for image folder data e.g. uploads/products & post image folder
cache_images: true # when true (global), new or modified images are downloaded from endpoint_uploads; note: Docker is also caching downloaded images.
collections:
@ -74,10 +74,14 @@ api:
type: posts # required; used for directory creation and organizing files
filepath: '_data/posts/index.json' # the filepath for posts json hash
# the "products" collection
products: # optional?
products: # optional
# Collection name (optional). Used to construct the url requested. Example: type `foo` would generate the following url `http://localhost:1337/foo`.
type: products # required; used for directory creation and organizing files
filepath: '_data/products/index.json' # the filepath for products json hash
authors: # required
# Collection name (optional). Used to construct the url requested. Example: type `foo` would generate the following url `http://localhost:1337/foo`.
type: authors # required; used for directory creation and organizing files
filepath: '_data/authors/index.json' # the filepath for products json hash
# ===================================================================================
# Collection configuration

View File

@ -5,7 +5,7 @@ Charles:
last_name: "Sharpe"
site: "https://www.csharpe.me"
avatar: "/uploads/authors/c-avatar.webp" #Size of avatar_image 36x36
bio: "A Stack Architect; curious about Astronomy, Information Technology, Privacy, Permaculture, Philosophy & Consciousness."
bio: "🖥️ A Stack Architect, 🦅 A Director, 🎖️ A USAF Veteran, 📜 Intergalactic Confederation, ⚡ ἀγάπηφῶς"
email: "info@sharpetronics.com"
# Twitter nick for use in Twitter cards and follow button.
twitter: "csharpe_me" # if no twitter in this config, the twitter follow button will be removed
@ -16,7 +16,4 @@ Charles:
url: "https://github.com/csharpee"
- title: "twitter"
url: "https://www.twitter.com/odinzu_me"
Dexter:
---

1
_data/authors/index.json Normal file
View File

@ -0,0 +1 @@
{"data":[{"id":1,"attributes":{"createdAt":"2022-05-23T23:00:27.098Z","updatedAt":"2022-11-02T23:43:42.752Z","locale":"en","name":"Charles","website":"https://sharpetronics.com","short_biography":"🖥️ A Stack Architect, 🦅 A Director, 🎖️ A USAF Veteran, 📜 Intergalactic Confederation, ⚡ ἀγάπηφῶς","twitter_username":"odinzu_me","github_username":"csharpee","avatar_image":{"data":{"id":55,"attributes":{"name":"c-avatar.webp","alternativeText":"c-avatar.webp","caption":"c-avatar.webp","width":200,"height":200,"formats":{"thumbnail":{"name":"thumbnail_c-avatar.webp","hash":"thumbnail_c_avatar_30ba895a14","ext":".webp","mime":"image/webp","path":null,"width":156,"height":156,"size":2.36,"url":"/uploads/thumbnail_c_avatar_30ba895a14.webp"}},"hash":"c_avatar_30ba895a14","ext":".webp","mime":"image/webp","size":18.42,"url":"/uploads/c_avatar_30ba895a14.webp","previewUrl":null,"provider":"local","provider_metadata":null,"createdAt":"2022-11-02T19:05:28.860Z","updatedAt":"2022-11-02T19:05:28.860Z"}}},"localizations":{"data":[]}}},{"id":2,"attributes":{"createdAt":"2022-11-02T23:43:32.121Z","updatedAt":"2022-11-02T23:43:56.227Z","locale":"en","name":"Dexter","website":"https://csharpe.me","short_biography":"I am a biography!","twitter_username":"csharpe_me","github_username":"csharpee","avatar_image":{"data":{"id":56,"attributes":{"name":"Profile-pic.jpeg","alternativeText":"Profile-pic.jpeg","caption":"Profile-pic.jpeg","width":460,"height":460,"formats":{"thumbnail":{"name":"thumbnail_Profile-pic.jpeg","hash":"thumbnail_Profile_pic_5c8182992f","ext":".jpeg","mime":"image/jpeg","path":null,"width":156,"height":156,"size":5.44,"url":"/uploads/thumbnail_Profile_pic_5c8182992f.jpeg"}},"hash":"Profile_pic_5c8182992f","ext":".jpeg","mime":"image/jpeg","size":44.04,"url":"/uploads/Profile_pic_5c8182992f.jpeg","previewUrl":null,"provider":"local","provider_metadata":null,"createdAt":"2022-11-02T23:35:27.113Z","updatedAt":"2022-11-02T23:35:27.113Z"}}},"localizations":{"data":[]}}}],"meta":{"pagination":{"page":1,"pageSize":25,"pageCount":1,"total":2}}}

View File

@ -24,7 +24,7 @@ location_coords: "39.63;-79,96"
terms_link: /blog/legal/2020/02/03/our-terms-and-conditions/
privacy_link: /blog/legal/2020/02/03/our-privacy-policy/
sitemap_link: /sitemap.xml
license_shorthand: This is Free Software released under <a href="https://www.gnu.org/licenses/gpl-3.0.en.html">GPLv3</a>.
license_shorthand: This is <a href="https://softwarefreedom.org/" target="_blank">Free Software</a> released under <a href="https://www.gnu.org/licenses/gpl-3.0.en.html" target="_blank">GPLv3</a>.
license_longhand: >- # this means to ignore newlines
This is Free Software released under GPLv3. Any misuse of this software
will be followed up with GPL enforcement via Software Freedom Law Center:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,14 +2,17 @@
The author metadata for both posts and post single pages.
{% endcomment %}
{% if post == blank %}
{% comment %}
Fix display bug when author data is empty.
{% endcomment %}
<div class="meta">
<time class="published">{{ page.date | date_to_string }}</time>
<h5 class="author"><img src="{{ page.author_image }}" alt="{{ page.author }}" /><span class="name">{{ page.author }}</span></h5>
</div>
{% else %}
<div class="meta">
<time class="published">{{ post.date | date_to_string }} {{ page.date | date_to_string }}</time>
<h5 class="author"><img src="{{ author.avatar }}" alt="{{ author.first_name }} {{ author.last_name }}" /><span class="name">{{ author.first_name }}</span></h5>
<time class="published">{{ post.date | date_to_string }} </time>
<h5 class="author"><img src="{{ post.author_image }}" alt="{{ post.author }}" /><span class="name">{{ post.author }}</span></h5>
</div>
{% endif %}

View File

@ -33,15 +33,19 @@ Quality Assurance: @odinzu_me
<META NAME="ICBM" content="{{ site.data.global.location_coords }}" />
<!-- Standard SEO Twitter Card data -->
<META NAME="twitter:card" content="summary">
<META NAME="twitter:site" content="@{{ site.data.social.twitter_user }}">
<META NAME="twitter:title" content="{{ page.title }}">
<META NAME="twitter:description" content="{{ page.description }}">
<META NAME="twitter:creator" content="@{{ site.data.social.twitter_user }}">
<META property="twitter:card" content="summary">
<META property="twitter:site" content="@{{ site.data.social.twitter_user }}">
<META property="twitter:title" content="{{ page.title }}">
<META property="twitter:description" content="{{ page.description }}">
<META property="twitter:creator" content="@{{ site.data.social.twitter_user }}">
<!-- Standard SEO Twitter Summary card images must be at least 120x120px -->
<META NAME="twitter:image" content="{{ page.image_url }}">
<META NAME="twitter:alt" content="{{ page.image_alt }}">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{{ page.url }}">
<meta property="twitter:title" content="{{ page.title }}">
<meta property="twitter:description" content="{{ page.description }}">
<meta property="twitter:image" content="{{ page.image_url }}">
<meta property="twitter:creator" content="{{ page.author }}">
<!-- Standard SEO Open Graph data -->
<META property="og:title" content="{{ page.title }}" />

View File

@ -0,0 +1,12 @@
{%- for post in related_posts -%}
<div class="col-4 col-12-small vert-expand">
<article class="post product no-padding">
<a href="{{ post.url | absolute_url }}"><img alt="{{ post.title }}" src="{{ post.banner_image }}" class="image fit" /></a>
<a href="{{ post.url | absolute_url }}"><h4> {{ post.title | strip_html | truncatewords: 7 }} </h4></a>
<p>{{ post.content | markdownify | strip_html | truncatewords: 19 }}</p>
<ul class="actions">
<li><a href="{{ post.url | absolute_url }}" class="button">Continue ></a></li>
</ul>
</article>
</div>
{% endfor %}

View File

@ -0,0 +1,5 @@
<section class="box alt">
<div class="row gtr-50 gtr-uniform">
<div class="col-2"><span class="image fit"><img src="{{ page.gallery_image }}" alt="{{ page.gallery_image_alt }}"></span></div>
</div>
</section>

View File

@ -1,22 +0,0 @@
<!-- Initial headline product collection post -->
<article class="post featured product no-padding">
<section class="row">
<div class="col-6 col-12-small headline-col-limit">
<picture>
<a href="{{ paginator.posts[0].url | absolute_url }}">
<img alt="{{ paginator.posts[0].title }}" src="{{ paginator.posts[0].banner_image }}" class="product-headline-flex" />
</a>
</picture>
</div>
<div class="col-6 col-12-small product-hero-text">
<a href="{{ paginator.posts[0].url | absolute_url }}"><h3> {{ paginator.posts[0].title }} </h3></a>
<p>{{ paginator.posts[0].content | strip_html | truncatewords: 50 }}</p>
<ul class="actions">
<li><a href="{{ paginator.posts[0].url | absolute_url }}" class="button">Continue ></a></li>
</ul>
</div>
</section>
</article>

View File

@ -0,0 +1,22 @@
<!-- Initial headline product collection post -->
<article class="post featured product no-padding">
<section class="row">
<div class="col-6 col-12-small headline-col-limit">
<picture>
<a href="{{ paginator.posts[0].url | absolute_url }}">
<img alt="{{ paginator.posts[0].title }}" src="{{ paginator.posts[0].banner_image }}" class="product-headline-flex" />
</a>
</picture>
</div>
<div class="col-6 col-12-small product-hero-text vert-expand">
<a href="{{ paginator.posts[0].url | absolute_url }}"><h3> {{ paginator.posts[0].title }} </h3></a>
<p>{{ paginator.posts[0].content | strip_html | truncatewords: 50 }}</p>
<ul class="actions">
<li><a href="{{ paginator.posts[0].url | absolute_url }}" class="button">Continue ></a></li>
</ul>
</div>
</section>
</article>

View File

@ -1,11 +1,11 @@
{%- for post in related_posts -%}
{%- for product in related_products -%}
<div class="col-4 col-12-small vert-expand">
<article class="post product no-padding">
<a href="{{ post.url | absolute_url }}"><img alt="{{ post.title }}" src="{{ post.banner_image }}" class="image fit" /></a>
<a href="{{ post.url | absolute_url }}"><h4> {{ post.title | strip_html | truncatewords: 7 }} </h4></a>
<p>{{ post.content | markdownify | strip_html | truncatewords: 19 }}</p>
<a href="{{ product.url | absolute_url }}"><img alt="{{ product.title }}" src="{{ product.banner_image }}" class="image fit" /></a>
<a href="{{ product.url | absolute_url }}"><h4> {{ product.title | strip_html | truncatewords: 7 }} </h4></a>
<p>{{ product.content | markdownify | strip_html | truncatewords: 19 }}</p>
<ul class="actions">
<li><a href="{{ post.url | absolute_url }}" class="button">Continue ></a></li>
<li><a href="{{ product.url | absolute_url }}" class="button">Continue ></a></li>
</ul>
</article>
</div>

View File

@ -27,7 +27,7 @@ pagination:
<!-- Content -->
<div class="content">
{{ content }}
{% assign author = site.data.authors[page.author] %}
{% assign author = page.author %}
{%- include author_card.html -%}
{%- include back-to-top.html -%}
<!-- Related posts collection -->
@ -36,7 +36,7 @@ pagination:
<h3>More Posts</h3>
</div>
{%- assign related_posts = site.posts | where_exp:"post", "post.url != page.url" | sample:3 -%}
{%- include product_related.html -%}
{%- include post_related.html -%}
</section>
<!-- A Placeholder for Community Discussion aka Comments -->

View File

@ -35,20 +35,38 @@ pagination:
<div class="col-6 col-12-small product-image">
<section class="">
<a href="#"><img alt="{{ page.title }}" src="{{ page.banner_image }}" class="product-flex" /></a>
<!-- Product Gallery Grid -->
{%- include product-grid-gallery.html -%}
</section>
</div>
<!-- Product Details List -->
<div class="col-6 col-12-small product-details">
<section class="">
<ul>
<li>Price:</li>
<li>Weight:</li>
<li>Stock:</li>
<li>Sku:</li>
<li>Format:</li>
<li>Material:</li>
<li>Reviews:</li>
<h4>Product Details</h4>
<li><b>Price:</b> ${{ page.unit_price | precision: 2}}</li>
<li><b>Currency Type:</b> {{ page.currency_type }}</li>
<li><b>Quantity:</b> {{ page.quantity | precision: 1}}</li>
<li><b>Material Type:</b> {{ page.material_type }}</li>
<li><b>Country Origin:</b> {{ page.country_origin }}</li>
<li><b>Tax Code:</b> {{ page.tax_code }}</li>
<li><b>Sku:</b> {{ page.stripe_id }}</li>
<li><b>Digital Software:</b> {{ page.is_software }}</li>
<li><b>Tags:</b> {{ page.tags }}</li>
<li><b>Shippable:</b> {{ page.is_shippable }}</li>
</ul>
{% if page.is_shippable == "true" %}
<ul>
<h4>Shipping Details</h4>
<li><b>Costs:</b> ${{ page.shipping_price | precision: 2}}</li>
<li><b>Rates:</b> {{ page.shipping_rates }}</li>
<li><b>Company:</b> {{ page.shipping_company }}</li>
<li><b>Weight:</b> {{ page.weight }} lbs</li>
<li><b>Dimensions:</b> {{ page.package_dimensions }}</li>
<li><b>Sku:</b> {{ page.stripe_id }}</li>
</ul>
{% endif %}
<!-- Product Add To Cart Button -->
<a href="#" class="button fit">Add To Cart</a>
</section>
@ -62,7 +80,7 @@ pagination:
</div>
<div class="col-12">
{{ content }}
{% assign author = site.data.authors[page.author] %}
{% assign author = page.author %}
{%- include author_card.html -%}
</div>
</section>
@ -72,7 +90,7 @@ pagination:
<div class="col-12">
<h3>More Products</h3>
</div>
{%- assign related_posts = site.products | where_exp:"post", "post.url != page.url" | sample:3 -%}
{%- assign related_products = site.products | where_exp:"product", "product.url != page.url and product.layout == 'product'" | sample:3 -%}
{%- include product_related.html -%}
</section>
</div>

View File

@ -20,7 +20,7 @@ layout: post
<div class="content">
<!-- Hero Product Post -->
{%- include product_headline.html -%}
{%- include product_hero.html -%}
<!-- Featured Product Posts -->
<section class="row">

View File

@ -41,7 +41,8 @@ api_endpoint = f['api']['endpoint']
endpoint_param = f['api']['endpoint_param']
endpoint_ext = f['api']['endpoint_ext']
Jekyll.logger.debug "DEBUG: API_ENDPDOINT for GET COLLECTIONS: " "#{api_endpoint}".to_s.yellow.bold
media_dir = f['api']['local_media_dir']
Jekyll.logger.debug "CONFIG DEBUG: MEDIA_DIR: " "#{media_dir}".to_s.yellow.bold
# authenticated or public API data
# import API_TOKEN from the environment. e.g. export API_TOKEN=example
api_token = ENV['API_TOKEN']
@ -75,11 +76,14 @@ if "#{api_token}".blank?
end # close if/else
# parses through local Jekyll _config.yml file and gets collection `type`
posts_type = f['api']['collections']['posts']['type']
Jekyll.logger.debug "CONFIG DEBUG: JEKYLL CONFIG POSTS PATH: " "#{posts_type}".to_s.yellow.bold
products_type = f['api']['collections']['products']['type']
Jekyll.logger.debug "CONFIG DEBUG: JEKYLL CONFIG PRODUCTS PATH: " "#{products_type}".to_s.yellow
posts_type = f['api']['collections']['posts']['type']
Jekyll.logger.debug "CONFIG DEBUG: JEKYLL CONFIG POSTS PATH: " "#{posts_type}".to_s.yellow.bold
authors_type = f['api']['collections']['authors']['type']
Jekyll.logger.debug "CONFIG DEBUG: JEKYLL CONFIG AUTHORS PATH: " "#{authors_type}".to_s.yellow.bold
# store filepath config options
posts_filepath = f['api']['collections']['posts']['filepath']
@ -88,12 +92,42 @@ Jekyll.logger.debug "CONFIG DEBUG: JEKYLL CONFIG POSTS FILEPATH: " "#{posts_file
products_filepath = f['api']['collections']['products']['filepath']
Jekyll.logger.debug "CONFIG DEBUG: JEKYLL CONFIG PRODUCTS FILEPATH: " "#{products_filepath}".to_s.yellow
authors_filepath = f['api']['collections']['authors']['filepath']
Jekyll.logger.debug "CONFIG DEBUG: JEKYLL CONFIG AUTHORS FILEPATH: " "#{authors_filepath}".to_s.yellow
puts Dir.pwd # where is local directory from plugins folder?
puts Dir.entries("./_data/") # gets contents of local web app dir
# Create posts directory only if they don't exist
if not Dir.exist?("./_data/""#{posts_type}")
Jekyll.logger.info "the Jekyll posts directory does not exist, let's create one".to_s.red
Dir.mkdir("./_data/""#{posts_type}")
Jekyll.logger.info "DIR DEBUG: The local ./_data/posts directory is created at: " "#{posts_type}".to_s.yellow
end
# Create products directory only if they don't exist
if not Dir.exist?("./_data/""#{products_type}")
Jekyll.logger.info "the Jekyll products directory does not exist, let's create one".to_s.red
Dir.mkdir("./_data/""#{products_type}")
Jekyll.logger.info "DIR DEBUG: The local ./_data/products directory is created at: " "#{products_type}".to_s.yellow
end
# Create author directory only if they don't exist
if not Dir.exist?("./_data/""#{authors_type}")
Jekyll.logger.info "the Jekyll ./_data/authors directory does not exist, let's create one".to_s.red
Dir.mkdir("./_data/""#{authors_type}")
Jekyll.logger.info "DIR DEBUG: The local authors directory is created at: " "#{authors_type}".to_s.yellow
end
# build the resource link & populate posts json data
uri_posts = "#{api_endpoint}#{endpoint_ext}#{posts_type}#{endpoint_param}"
Jekyll.logger.debug "HTTP DEBUG: POSTS URI: " "#{uri_posts}".to_s.yellow.bold
# build the resource link & populate posts json data
uri_products = "#{api_endpoint}#{endpoint_ext}#{products_type}#{endpoint_param}"
Jekyll.logger.debug "HTTP DEBUG: PRODUCTS URI: " "#{uri_products}".to_s.yellow
# build the resource link & populate author json data
uri_authors = "#{api_endpoint}#{endpoint_ext}#{authors_type}#{endpoint_param}"
Jekyll.logger.debug "HTTP DEBUG: AUTHORS URI: " "#{uri_authors}".to_s.yellow.bold
# the actual GET with header data; retrieve all product and posts json data from API
posts_api_connect = api_builder.get(uri_posts)
@ -102,6 +136,9 @@ Jekyll.logger.debug "HTTP DEBUG: THE COLLECTION is: #{posts_type} with STATUS CO
products_api_connect = api_builder.get(uri_products)
Jekyll.logger.debug "HTTP DEBUG: THE COLLECTION is: #{products_type} with STATUS CODE: #{products_api_connect.status}".to_s.cyan.bold
authors_api_connect = api_builder.get(uri_authors)
Jekyll.logger.debug "HTTP DEBUG: THE COLLECTION is: #{authors_type} with STATUS CODE: #{authors_api_connect.status}".to_s.cyan.bold
# store all data into the body of the api
posts_json_data = posts_api_connect.body
Jekyll.logger.debug "HTTP DEBUG: IS POST JSON DATA EMPTY? #{posts_json_data.empty?}".to_s.yellow
@ -109,6 +146,9 @@ Jekyll.logger.debug "HTTP DEBUG: IS POST JSON DATA EMPTY? #{posts_json_data.empt
products_json_data = products_api_connect.body
Jekyll.logger.debug "HTTP DEBUG: IS PRODUCT JSON DATA EMPTY? #{products_json_data.empty?}".to_s.yellow
authors_json_data = authors_api_connect.body
Jekyll.logger.debug "HTTP DEBUG: IS AUTHORS JSON DATA EMPTY? #{products_json_data.empty?}".to_s.yellow
# opens the posts file and writes the data to the file
Jekyll.logger.debug "WRITING RAW POSTS JSON DATA TO FILE...".yellow.bold
File.write(posts_filepath, JSON.dump(posts_json_data))
@ -122,3 +162,10 @@ File.write(products_filepath, JSON.dump(products_json_data))
puts ""
Jekyll.logger.debug "SUCCESS! JSON PRODUCTS FILE DOWNLOADED...".cyan.bold
puts ""
# opens the authors file and writes the data to the file
Jekyll.logger.debug "WRITING RAW PRODUCTS JSON DATA TO FILE...".yellow.bold
File.write(authors_filepath, JSON.dump(authors_json_data))
puts ""
Jekyll.logger.debug "SUCCESS! JSON AUTHORS FILE DOWNLOADED...".cyan.bold
puts ""

View File

@ -41,15 +41,20 @@ module Jekyll
# set filepath, load the json, then parse through json file
json_post_path = f['api']['collections']['posts']['filepath']
json_author_path = f['api']['collections']['authors']['filepath']
# must read data into memory before parsing file
read_posts_json = File.read(json_post_path) # read json for all posts
read_authors_json = File.read(json_post_path) # read json for all authors
# parse through json files
parsed_posts_file = JSON.parse(read_posts_json.to_s) # returns a hash
parsed_authors_file = JSON.parse(read_authors_json.to_s) # returns a hash
# cache / verify and download each post data
post_ids = parsed_posts_file["data"]
author_ids = parsed_authors_file["data"]
# loop through each post id
post_ids.each do |id|
@ -100,7 +105,15 @@ module Jekyll
author = id["attributes"]["author"]["data"]["attributes"]["name"]
Jekyll.logger.debug "::DOCUMENT POST DEBUG:: Author: " "#{author}".to_s.yellow
end
# determine if author avatar data is blank or null.
if "#{id["attributes"]["author"]["data"]["attributes"]["avatar_image"]["data"]}".blank? || "#{id["attributes"]["author"]["data"]["attributes"]["avatar_image"]["data"]}".empty?
Jekyll.logger.debug "ERROR: the author avatar data is missing; does post [" "#{title}] have a author avatar?".to_s.red
else
author_image = id["attributes"]["author"]["data"]["attributes"]["avatar_image"]["data"]["attributes"]["url"]
Jekyll.logger.debug "::DOCUMENT POST DEBUG:: Author_Avatar URL: " "#{author_image}".to_s.yellow
end
# determine if banner_image is blank or null.
if "#{id["attributes"]["banner_image"]["data"]}".blank?
Jekyll.logger.debug "ERROR: the banner_image url is missing; does post [" "#{title}] have a banner image url?".to_s.red
@ -177,6 +190,7 @@ module Jekyll
p.puts "slug: #{slug}"
p.puts "date: #{date}"
p.puts "author: #{author}"
p.puts "author_image: #{author_image}"
p.puts "banner_image: #{banner_image}" # the banner images are downloaded from API in image-filter.rb.
p.puts "banner_image_description: #{banner_image_description}"
p.puts "category: " "#{category}"
@ -200,4 +214,5 @@ module Jekyll
p.puts "#{content}" # write post content
p.close # close the file; stop writing
end
end
end # jekyll module

View File

@ -118,6 +118,14 @@ module Jekyll
author = id["attributes"]["author"]["data"]["attributes"]["name"]
Jekyll.logger.debug "::DOCUMENT PRODUCT DEBUG:: Author: " "#{author}".to_s.yellow
end
# determine if author avatar data is blank or null.
if "#{id["attributes"]["author"]["data"]["attributes"]["avatar_image"]["data"]}".blank? || "#{id["attributes"]["author"]["data"]["attributes"]["avatar_image"]["data"]}".empty?
Jekyll.logger.debug "ERROR: the author avatar data is missing; does post [" "#{title}] have a author avatar?".to_s.red
else
author_image = id["attributes"]["author"]["data"]["attributes"]["avatar_image"]["data"]["attributes"]["url"]
Jekyll.logger.debug "::DOCUMENT POST DEBUG:: Author_Avatar URL: " "#{author_image}".to_s.yellow
end
# determine if banner_image is blank or null.
if "#{id["attributes"]["banner_image"]}".blank?
@ -318,6 +326,7 @@ module Jekyll
p.puts "slug: #{slug}"
p.puts "date: #{date}"
p.puts "author: #{author}"
p.puts "author_image: #{author_image}"
p.puts "banner_image: #{banner_image}" # the banner images are downloaded from API in image-filter.rb.
p.puts "banner_image_description: #{banner_image_description}"
p.puts "category: " "#{category}"

View File

@ -313,5 +313,79 @@ else
end # ends post collection id exist?
puts "" # pretty debug spacing
end # end post formatting check
# begin parsing through AUTHORS json data.
# prepare authors images from sorting the json data.
if f['api']['collections']['authors']['type'] != 'authors' # case sensitive
Jekyll.logger.debug "CONFIG DEBUG: AUTHORS FILEPATH IS MISSING or INCORRECT IN JEKYLL _CONFIG.YML, see documentation ".to_s.red
else
# load filepath, then parse through json file in _data/authors/index.json
json_authors_path = f['api']['collections']['authors']['filepath']
Jekyll.logger.debug "CONFIG DEBUG: AUTHORS PATH: " "#{json_authors_path}".to_s.yellow.bold
read_authors_json = File.read(json_authors_path) # read json for all authors
#Jekyll.logger.debug "DEBUG: READ JSON FILE: " "#{read_post_json}".to_s.yellow.bold # basic debug test
parsed_authors_json_file = JSON.parse(read_authors_json.to_s) # returns json hash
Jekyll.logger.debug "JSON DEBUG: IS PARSED_JSON_FILE MISSING? " "#{parsed_authors_json_file.blank?}".to_s.yellow # basic debug test
# cache / check and download all authors image data
authors_collection_ids = parsed_authors_json_file["data"]
# loop through each authors collection id
authors_collection_ids.each do |id|
# we only need the urls for each image to prep for download
#pp id
authors_avatar_images = id["attributes"]["avatar_image"]["data"]
# loop through each authors image.
authors_avatar_images.each do |a_image|
# get authors_avatar_images from each AUTHOR
if a_image.blank? || a_image.empty?
Jekyll.logger.debug "ERROR: IMAGE DATA EMPTY for AUTHORS: " "#{a_image["attributes"]["name"]}".to_s.red # basic debug test
else
# set uri_path https://www.example.com/uploads/example.webp
authors_avatar_image_uri_path = "#{api_endpoint}#{id["attributes"]["avatar_image"]["data"]["attributes"]["url"]}"
Jekyll.logger.debug "AUTHORS FILE DEBUG: AUTHOR AVATAR URI_PATH: " "#{authors_avatar_image_uri_path}".to_s.yellow.bold
# get image_file_name
authors_avatar_image_file_name = "#{id["attributes"]["avatar_image"]["data"]["attributes"]["hash"]}"
Jekyll.logger.debug "AUTHORS FILE DEBUG: AUTHORS AVATAR IMAGE URI_PATH: " "#{authors_avatar_image_file_name}".to_s.yellow.bold
# prepare filename
authors_avatar_image_file_ext = "#{id["attributes"]["avatar_image"]["data"]["attributes"]["ext"]}"
Jekyll.logger.debug "AUTHORS FILE DEBUG: THE FILE EXTENSION NAME: " "#{authors_avatar_image_file_ext}".to_s.yellow.bold # basic debug test
# if cached AUTHOR filename exists, skip; else check modified time.
if File.exist?(media_dir + authors_avatar_image_file_name + authors_avatar_image_file_ext) === false
# where the magic happens; we finally download a new image
authors_avatar_download_image = api_builder.get(authors_avatar_image_uri_path)
Jekyll.logger.debug "DOWNLOADING... THE AVATAR IMAGE URI IS: " "#{authors_avatar_image_uri_path}".to_s.cyan.bold # basic debug test
Jekyll.logger.debug "HTTP DEBUG: A NEW AVATAR IMAGE HTTP(S) RESPONSE: " "#{authors_avatar_download_image.status}\n" "#{authors_avatar_download_image.headers}\n".to_s.yellow # debug http response status
# only save file if data exists
authors_avatar_file_exist_debug = File.exist?(media_dir + authors_avatar_image_file_name + authors_avatar_image_file_ext) # file already exists?
Jekyll.logger.debug "FILE DEBUG: DOES AVATAR IMAGE ALREADY EXIST? " "#{authors_avatar_file_exist_debug}".to_s.yellow # basic debug test
# TODO: enable to work with Windows NTFS File Systems
#file_ctime = File.ctime(media_dir + file_name + file_ext) # in NTFS (Windows) returns creation time (birthtime)
#Jekyll.logger.debug "DEBUG: WHEN WAS FILE LAST MODIFIED? " "#{file_ctime}".to_s.yellow # basic debug test
c = File.open(authors_avatar_image_file_name + authors_avatar_image_file_ext, 'w') # w - Create an empty file for writing.
c.write(authors_avatar_download_image.body) # write the download to local media_dir
c.close # close the file
FileUtils.mv "#{c.path}", "#{media_dir}" # move the file to custom path
Jekyll.logger.debug "FILE DEBUG: THE WHOLE AVATAR IMAGE FILE NAME " "#{authors_avatar_image_file_name}" "#{authors_avatar_image_file_ext}".to_s.yellow.bold # basic debug test
else
Jekyll.logger.debug "AUTHOR IMAGE ALREADY EXISTS - SKIPPING".to_s.magenta
end # end cached if file exists
end # author image data exist?
end # author.images.each do
end # ends authors collection id exist?
puts "" # pretty debug spacing
end # end authors formatting check
end # end is cache_images enabled?

View File

@ -0,0 +1,38 @@
# A simple way to inspect liquid template variables.
# Usage:
# Can be used anywhere liquid syntax is parsed (templates, includes, posts/pages)
# {{ site | debug }}
# {{ site.posts | debug }}
#
require 'pp'
module Jekyll
# Need to overwrite the inspect method here because the original
# uses < > to encapsulate the psuedo post/page objects in which case
# the output is taken for HTML tags and hidden from view.
#
class Post
def inspect
"#Jekyll:Post @id=#{self.id.inspect}"
end
end
class Page
def inspect
"#Jekyll:Page @name=#{self.name.inspect}"
end
end
end # Jekyll
module Jekyll
module DebugFilter
def debug(obj, stdout=false)
puts obj.pretty_inspect if stdout
"<pre>#{obj.class}\n#{obj.pretty_inspect}</pre>"
end
end # DebugFilter
end # Jekyll
Liquid::Template.register_filter(Jekyll::DebugFilter)

View File

@ -0,0 +1,9 @@
module Jekyll
module PrecisionFilter
def precision(input, value=0)
("%.#{value}f" % input)
end
end
end
Liquid::Template.register_filter(Jekyll::PrecisionFilter)

View File

@ -12,6 +12,10 @@ body.single {
}
ul.actions li {
padding: 0em;
}
h1, h2, h3, h4, h5, h6, header.major h1, .icon.style3 {
color: #404040;
}
@ -192,7 +196,7 @@ a.author {
}
.vert-expand {
display: flex;
display: grid;
}
.post:hover {
@ -414,6 +418,10 @@ a.author {
width: 100%;
height: 100%;
}
div.product-hero-text {
padding: 0 0 0 .5em;
}
.product-hero-text p {
padding-bottom: .5em;
}

View File

@ -6,6 +6,7 @@ subheading: Your data is always yours.
slug: our-privacy-policy
date: 2020-02-03
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/terms_48bec2a697.webp
banner_image_description: an image gradient of blue and white.
category: Legal

View File

@ -6,6 +6,7 @@ subheading: Our rules and regulations.
slug: our-terms-and-conditions
date: 2020-02-03
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/terms_48bec2a697.webp
banner_image_description: an image gradient of blue and white.
category: Legal

View File

@ -6,6 +6,7 @@ subheading: Where light travels at high altitudes.
slug: welcome-to-an-appalachian-technology-company
date: 2021-01-03
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/wv_seneca_rocks_sky_0d5928baa9.webp
banner_image_description: An image of the night sky in West Virginia.
category: Company

View File

@ -6,6 +6,7 @@ subheading: Winding Roads
slug: sharpetronics-inc-becomes-official
date: 2021-03-17
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/pillars_face_art_973bf824dd.webp
banner_image_description: A pillar with a head holding up the ceiling.
category: Company

View File

@ -6,6 +6,7 @@ subheading: Liquid Democracy Empowering Network Users
slug: big-startups-without-big-tech
date: 2021-06-29
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/decentralized_385bd5a376.webp
banner_image_description: Transparent cubes and a high tech lighting backdrop
category: How-to

View File

@ -6,6 +6,7 @@ subheading: Initializing a secure environment
slug: linux-vps-hardening
date: 2021-07-26
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/linux_admin_0def8999f2.webp
banner_image_description: The back of a black hoodie hacking at software
category: Devops

View File

@ -6,6 +6,7 @@ subheading: Compiling & Configuring Qt from Source
slug: configure-a-static-qt5-from-source-on-ubuntu-18-04-with-x11-support
date: 2021-11-11
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/quantum_qt5_41fa19c935.webp
banner_image_description: A golden circuit board.
category: Devops

View File

@ -6,6 +6,7 @@ subheading: Static Websites with CMS
slug: setup-a-secure-nginx-https-web-server-with-let-s-encrypt-strapi-4-0-headless-cms
date: 2021-12-27
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/santa_rudolph_unsplash_0ae8e3d5a7.webp
banner_image_description: Two feet wearing socks beside each other with faces of Santa Clause and another of Rudolph
category: How-to

View File

@ -6,6 +6,7 @@ subheading: Creating and host your own end-to-end encryption Instant Messenger a
slug: compiling-fresh-xmpp-ejabberd-server-binaries-22-05-on-ubuntu-20-04-with-erlang-otp-24
date: 2022-06-21
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/ejabberd_in_the_jungle_8a9f00e089.webp
banner_image_description: A human male swinging above the trees in a jungle.
category: Devops

View File

@ -6,6 +6,7 @@ subheading: Obiwon Can Oh Be! A digital C3-PO working beside you!
slug: how-to-setup-a-docker-drone-ci-with-https
date: 2022-06-23
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/r2d2_skywalker_c84e2364fe.webp
banner_image_description: r2d2 and Luke lego people standing on a laptop
category: How-to

View File

@ -6,6 +6,7 @@ subheading: BeeYoop BeeDeepBoom Weeop DEEpaEEya
slug: how-to-setup-a-secure-docker-drone-runner-with-drone-ci
date: 2022-06-23
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/c3po_a_friend_in_need_74a237a413.webp
banner_image_description: a picture of c3po from Star Wars
category: How-to

View File

@ -6,6 +6,7 @@ subheading: How-to replace the favicon
slug: update-your-strapi-cms-with-your-own-favicon
date: 2022-07-12
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/code_2b5ed5fa9c.webp
banner_image_description: computer code matrix
category: How-to

View File

@ -6,6 +6,7 @@ subheading: I was doing a bit of yak shaving this morning, and it looks like it
slug: upgrade-your-crosshair-vi-hero-motherboard-firmware-with-system76-s-pop-os
date: 2022-10-12
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/galactic_andromeda_workstation_393e5d94d4.webp
banner_image_description: a fresh computer desk with monitors from the Andromeda Galaxy.
category: How-to

View File

@ -7,6 +7,7 @@ subheading: sadfasdf
slug: chicken-platter
date: 2022-09-01
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/terms_48bec2a697.webp
banner_image_description: a short desc. about the banner image
category: How-to

View File

@ -7,6 +7,7 @@ subheading: test again yupy an update
slug: new-product-nameeee
date: 2022-09-13
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/optimus_primed_886bcb1942.jpeg
banner_image_description: this is a description
category: Legal

View File

@ -7,6 +7,7 @@ subheading: my sppooon is too beiigg
slug: i-am-a-bananna-product
date: 2022-10-04
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/santa_rudolph_unsplash_0ae8e3d5a7.webp
banner_image_description: a short desc. about the banner image
category: Company

View File

@ -1,12 +1,13 @@
---
stripe_id: 5
metadata: 2022-10-11T22:37:24+00:00
metadata: 2022-11-02T15:38:58+00:00
layout: product
heading: another productt
subheading: another producttatastasatdfg s
slug: another-productt
date: 2022-10-21
author: Charles
author_image: /uploads/c_avatar_30ba895a14.webp
banner_image: /uploads/code_2b5ed5fa9c.webp
banner_image_description: a short desc. about the banner image
category: Legal
@ -15,6 +16,12 @@ gallery:
title: code_2b5ed5fa9c
- image_path: /uploads/r2d2_skywalker_c84e2364fe.webp
title: r2d2_skywalker_c84e2364fe
- image_path: /uploads/312934415_1159579084970698_4992277526963175821_n_9b7c7c21a4.jpg
title: 312934415_1159579084970698_4992277526963175821_n_9b7c7c21a4
- image_path: /uploads/West_Virginia_state_coat_of_arms_illustrated_1876_1f0b28a5ea.jpg
title: West_Virginia_state_coat_of_arms_illustrated_1876_1f0b28a5ea
- image_path: /uploads/State_coat_of_arms_of_the_Netherlands_svg_da215b8e7d.png
title: State_coat_of_arms_of_the_Netherlands_svg_da215b8e7d
tags:
webpage_url: https://www.sharpetronics.com/products/2017-02-03-dragon

View File

@ -2,7 +2,7 @@
layout: posts
title: Journal
sub_title: A collection of articles about technology.
permalink: /blog/
permalink: /blog
pagination:
enabled: true

View File

@ -2,7 +2,7 @@
layout: products
title: Shop
sub_title: A collection of fine products.
permalink: /products/
permalink: /products
pagination:
enabled: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB