update favicon.ico and add base get-collections for cms #1

Merged
sharpetronics merged 1 commits from add-ruby-api-strapi into master 2022-06-28 00:10:29 -04:00
12 changed files with 1500 additions and 5 deletions

1
_data/posts/index.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
{% for item in site.data.posts.index.data %}
<li>
{{ item.id }} {{ item.attributes.title }} {{ item.attributes.updatedAt | date: "%Y" }}
<img src="{{site.url}}/uploads/2021/{{ item.attributes.image.data.attributes.name }}" />
{{ item.attributes.image.data.attributes.placeholder}}
</li>
{% endfor %}

View File

@ -13,6 +13,7 @@ layout: post
<!-- Main Body Content -->
<div class="content">
{%- include json-data-example.html -%}
<!-- This loops through the paginated posts collection posts-->
{% for post in paginator.posts %}
<!-- Post layout structure -->

View File

@ -1,18 +1,71 @@
# Copyright SharpeTronics, LLC. 2013-2022
# Author: Charles Sharpe
# License: None
require 'httparty'
require 'json'
require 'down'
class Post
include HTTParty
def initialize
# base url for remote server
@api_url = "https://dash.sharpetronics.com/api"
end
def all
self.class.get("#{@api_url}/posts?populate=*")
# create directory & file if doesn't exist
if not Dir.exist?('_data/posts/')
puts "_data/posts/ directory does not exist, I am going to create one".yellow
Dir.mkdir '_data/posts/'
end
if not File.exist?('./_data/posts/index.json')
puts "_data/posts/index.json file does not exist, I am going to create one".yellow
File.write('./_data/posts/index.json', 'amazing json data placeholder')
end
# import STRAPI_TOKEN from the environment. export STRAPI_TOKEN=example
strapi_token = ENV['STRAPI_TOKEN']
# check if strapi_token is auth or unauth
if strapi_token==nil
# logs data to screen
puts "STRAPI_TOKEN FAILED, trying an unauthenticated request...".red
options = {
headers: ""
}
else
options = {
# pass authorization header token from ENV
headers: {
'Authorization' =>"Bearer #{strapi_token}",
'Accept' => 'application/json'
},
format: :json
}
# set response with all posts data
response = self.class.get("#{@api_url}/posts?populate=*", options)
# logs data to screen
puts "STRAPI_TOKEN SUCCESS! Getting the authenticated data...".green
# turn http data into a string for json
res = response.to_s
# stdout pretty json on jekyll build
puts JSON.pretty_generate(JSON.parse(res))
# write raw json data to file
data_hash = JSON.parse(res)
File.write('./_data/posts/index.json', JSON.dump(data_hash))
# download image data to uploads/:year/:image-url
#url = @api_url.res
#Down.download(res, destination: "uploads/#{input['name']}")
# not being used
#file = File.read('./_data/posts/index.json')
end
end
end
# create new Post class
post = Post.new
pp post.all
# debug post.all from def all method
puts post.all

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="29.828613mm"
height="38.369175mm"
viewBox="0 0 29.828614 38.369174"
version="1.1"
id="svg1895"
inkscape:export-filename="../../../../../../../../../run/user/1000/gvfs/google-drive:host=gmail.com,user=sharpetronics/0AJONyYjFZQTJUk9PVA/1_jtkrLWhWz9fEuLXWP98AivaU9-4j89t/1eb5h_xIdCA9Bk6dGkZnEIfzmBCIsJSCC/1k8F-G9zqHicOUxfRaDk3FPE-ZSPUY3WC/svg/st_logo50x64ico.svg"
inkscape:export-xdpi="49.383881"
inkscape:export-ydpi="49.383881"
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
sodipodi:docname="st_logo125v2_ico.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs1889">
<inkscape:path-effect
effect="simplify"
id="path-effect1766"
is_visible="true"
steps="1"
threshold="0.0001"
smooth_angles="360"
helper_size="0"
simplify_individual_paths="false"
simplify_just_coalesce="false"
simplifyindividualpaths="false"
simplifyJustCoalesce="false"
lpeversion="0" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffe4"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="2.8284271"
inkscape:cx="-8.131728"
inkscape:cy="135.05739"
inkscape:document-units="px"
inkscape:current-layer="svg1895"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="212"
inkscape:window-maximized="1"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#ffffe4" />
<metadata
id="metadata1892">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:creator>
<cc:Agent>
<dc:title>Charles Sharpe</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Charles Sharpe</dc:title>
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title>Charles Sharpe</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>Charles Sharpe</dc:identifier>
<dc:source>https://www.sharpetronics.com</dc:source>
<dc:description />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Layer 2 Gray"
style="display:inline"
transform="translate(-30.681616,2.6221575)">
<ellipse
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.12403;stroke-linecap:square;stroke-linejoin:round;stroke-opacity:0.997438;paint-order:stroke markers fill"
id="path590"
cx="45.595924"
cy="16.562429"
rx="14.352293"
ry="18.622572" />
</g>
<g
id="g3457"
transform="matrix(1.5609103,0,0,1.5609103,4.8083076,6.9404803)"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
style="display:inline;fill:none;stroke:#ffffff;stroke-width:2.20358;stroke-dasharray:none;stroke-opacity:0.99693">
<path
id="path827-6-0-8-5-8-3-6-27-9"
style="display:inline;fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2.20358;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99693;paint-order:normal"
d="M 5.1116695,8.7277053 C 5.2425367,8.7167236 5.3734039,8.705742 5.5042711,8.6947603 m 0.8131337,0.7290729 c 0.1254667,-0.00784 0.2509334,-0.01568 0.3764001,-0.02352 M 3.9190046,7.6311125 C 5.477458,8.565363 7.0359114,9.4996135 8.5943648,10.433864 M 13.027632,2.1076418 C 11.377835,1.1551336 9.7280385,0.20262539 8.0782417,-0.74988281 M 13.029508,7.811513 c 0,-1.9061848 0,-3.8123697 0,-5.7185545 M 8.07593,4.96636 c 0,-1.9061848 0,-3.8123697 0,-5.71855448 M 4.84967,10.30975 C 3.3264467,11.896693 1.8032233,13.483637 0.28,15.07058 m 0,0 C 2.8786433,13.58252 5.4772867,12.09446 8.07593,10.6064 m -1.78836,1.02617 c 0.1908307,0.351726 0.3439584,0.722655 0.4781162,1.099221 0.1990241,0.558639 0.3589132,1.130394 0.5025773,1.705488 0.2230145,0.892737 0.4027089,1.795401 0.5935133,2.695357 0.067911,0.320312 0.1368287,0.640471 0.2141632,0.958664 M 13.027987,7.8110215 C 12.025612,8.7075003 11.158973,9.7518316 10.438558,10.886291 9.8029244,11.887243 9.2768169,12.95807 8.8764406,14.074163 8.5830727,14.891958 8.3544705,15.734293 8.2155678,16.592325 8.135321,17.088027 8.0846742,17.589037 8.07593,18.0913 m 0,-7.4849 c 0,2.494967 0,4.989933 0,7.4849 M 13.018954,7.78638 C 11.371279,6.8463733 9.7236047,5.9063667 8.07593,4.96636 m 4.949339,2.8430777 C 11.375489,8.7417585 9.7257097,9.6740792 8.07593,10.6064 M 4.84967,5.26301 C 3.3264467,3.67607 1.8032233,2.08913 0.28,0.50219 M 0.53368,7.79227 C 1.9723433,6.9491833 3.4110067,6.1060967 4.84967,5.26301 M 0.28,0.50219 C 2.8786433,1.9902467 5.4772867,3.4783033 8.07593,4.96636 M 3.19151,7.78638 C 4.81965,6.8463733 6.44779,5.9063667 8.07593,4.96636 M 0.53368001,7.79405 C 1.9723433,8.63262 3.4110067,9.47119 4.84967,10.30976 M 3.19151,7.78638 C 3.1478346,7.6952461 3.1014868,7.6033965 3.0806172,7.5041348 c -0.00964,-0.045857 -0.022588,-0.099757 0.00414,-0.1417183 0.021487,-0.033738 0.066708,-0.036423 0.102436,-0.03092 0.067703,0.010428 0.1314102,0.037896 0.1925029,0.067717 0.1433988,0.069998 0.2790546,0.1546777 0.412341,0.2420509 0.2941768,0.1928415 0.5797028,0.3984688 0.8642377,0.605139 C 5.24609,8.6748151 5.8328636,9.107534 6.4304953,9.5250662 6.9685624,9.9009839 7.5145402,10.266082 8.07593,10.6064"
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccc"
class="UnoptimicedTransforms"
inkscape:original-d="m 5.1116695,8.7277053 0.3926016,-0.032945 m 0.8131337,0.7290729 0.3764001,-0.02352 M 3.9190046,7.6311125 8.5943648,10.433864 M 13.027632,2.1076418 8.0782417,-0.74988281 M 13.029508,7.811513 V 2.0929585 M 8.07593,4.96636 V -0.75219448 M 4.84967,10.30975 0.28,15.07058 m 0,0 7.79593,-4.46418 m -1.78836,1.02617 c 0.91457,1.6797 1.37514,4.76312 1.78837,6.45873 M 13.027987,7.8110215 C 9.7529773,10.739792 8.1271988,15.078354 8.07593,18.0913 m 0,-7.4849 v 7.4849 M 13.018954,7.78638 8.07593,4.96636 M 13.025269,7.8094377 8.07593,10.6064 M 4.84967,5.26301 0.28,0.50219 M 0.53368,7.79227 4.84967,5.26301 M 0.28,0.50219 8.07593,4.96636 M 3.19151,7.78638 8.07593,4.96636 M 0.53368001,7.79405 4.84967,10.30976 M 3.19151,7.78638 C 2.4528879,6.2713071 5.199809,8.8639251 8.07593,10.6064"
inkscape:path-effect="#path-effect1766" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/icons/my-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -72,4 +72,6 @@ services:
- '.:/srv/jekyll'
ports:
- 4000:4000
environment:
- STRAPI_TOKEN=$STRAPI_TOKEN
command: jekyll serve --lsi --watch --verbose --trace

View File

@ -0,0 +1,22 @@
$:.unshift(File.expand_path("../", __FILE__))
require "jekyll/strapi/version"
Gem::Specification.new do |spec|
spec.version = Jekyll::Strapi::VERSION
spec.homepage = "https://github.com/strapi/jekyll-strapi"
spec.authors = ["SharpeTronics", "Charles Sharpe"]
spec.email = ["hi@strapi.io", "info@sharpetronics.com"]
spec.summary = "Strapi.io integration for Jekyll"
spec.name = "jekyll-strapi"
spec.license = "MIT"
spec.description = spec.description = <<-DESC
A Jekyll plugin for retrieving content from a Strapi API
DESC
spec.add_runtime_dependency("down", "~> 5.0")
spec.add_runtime_dependency("jekyll", "~> 4")
spec.add_runtime_dependency("http", "~> 3.2")
spec.add_runtime_dependency("json", "~> 2.1")
end