Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy Readme, add socials, move version history #247

Open
wants to merge 91 commits into
base: master
Choose a base branch
from

Conversation

Darthagnon
Copy link
Contributor

NB: there is a copy of Readme (not updated) in the theme root, socials.toml should probably be filled with dummy data or moved to example site, version-history.md can be merged with CHANGELOG.md?

NB: there is a copy of Readme (not updated) in the theme root, socials.toml should probably be filled with dummy data or moved to example site, version-history.md can be merged with CHANGELOG.md?
@Darthagnon
Copy link
Contributor Author

Darthagnon commented Sep 9, 2021

Question: is it possible to move all language data from data to i18n? Seems bizarre to separate weekdays from the rest of the i18n stuff.

I'll do it later in this pull request if I can find all the references to the weekdays, but as I don't know the code inside out, just thought I'd check.

@g1eny0ung
Copy link
Owner

NB: there is a copy of Readme (not updated) in the theme root

Both READMEs need to be updated, one for the hugo theme and one for GitHub.

, socials.toml should probably be filled with dummy data or moved to example site

I agree with placing dummy data to data/socials.toml. But it requires my personal information to be replaced with a placeholder, like xxx. 😌

, version-history.md can be merged with CHANGELOG.md?

And I also agree to place the version-history into CHANGELOG. This way only one file is maintained.

Question: is it possible to move all language data from data to i18n? Seems bizarre to separate weekdays from the rest of the i18n stuff.

Since we use .Site.Data in summary.html and single.html, these files have to be in the data folder. Maybe we could create data/i18n and put all the localization related files in there? That would be neater.

There were 2 copies of README.md, only keep 1. Merge version-history.md with CHANGELOG.md (could use further tidying). Some minor English grammar corrections.
Why is there a massive ## Tags section in the README? Demote to minor section near the end, formatted as it is in the theme.toml to allow easier copypasta when adding/removing tags (which are now in alphabetical order).
…uplicate README.md

README.md duplicate required because of GitHub vs. GoHugo.io, according to g1eny0ung. mailto: skype: tox: tel: and Whatsapp all need testing.
…from USA

USA formats dates as MM/DD/YYYY, it annoys me, as an international/UK English speaker. International and UK standard is DD/MM/YYYY; see https://www.quora.com/Why-are-these-2-different-date-format-used-dd-mm-yy-and-mm-dd-yy-They-sometimes-cause-confusion
A lot of repetition; wondering if it's worth/possible to make i18n.html and referring to that whenever this is required. Hope it doesn't slow site loading. Next step: try and move lang.toml files to their own folder.
@Darthagnon
Copy link
Contributor Author

Darthagnon commented Sep 16, 2021

Question: is it possible to put the whole i18n block within its own i18n.html file and reference it where required? Seems like it should be possible, but I'm not expert enough with HTML. Would save repeating the following 3 times:

| {{ if .Site.Params.Experimental.jsDate }}
                  <span data-format="luxon">{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</span>
                {{ else }}
                  {{ if eq .Site.Language.Lang "zh" }}
                    {{ index .Site.Data.zh.Weekday (printf "%d" .Date.Weekday) }},{{ index .Site.Data.zh.Month (printf "%d" .Date.Month) }} {{ .Date.Day }} 日,{{ .Date.Year }} 年
                  {{ else if eq .Site.Language.Lang "es" }}
                    {{ index .Site.Data.es.Weekday (printf "%d" .Date.Weekday) }}, {{ .Date.Day }} de {{ index .Site.Data.es.Month (printf "%d" .Date.Month) }} de {{ .Date.Year }}
                  {{ else if eq .Site.Language.Lang "pt" }}
                    {{ index .Site.Data.pt.Weekday (printf "%d" .Date.Weekday) }}, {{ .Date.Day }} de {{ index .Site.Data.pt.Month (printf "%d" .Date.Month) }} de {{ .Date.Year }}
                  {{ else if eq .Site.Language.Lang "fr" }}
                    {{ index .Site.Data.fr.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.fr.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
<!-- added some new language formatting alphabetically below this line. May have left out connecting words for languages I don't know; need native users to feed back -->			
		           {{- else if eq .Site.Language.Lang "ar" -}}
                    {{ index .Site.Data.ar.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ar.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "ca" -}}
                    {{ index .Site.Data.ca.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ca.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "de" -}}
                    {{ index .Site.Data.de.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.de.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}	
		           {{- else if eq .Site.Language.Lang "he" -}}
                    {{ index .Site.Data.he.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.he.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}		
		           {{- else if eq .Site.Language.Lang "it" -}}
                    {{ index .Site.Data.it.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.it.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "ja" -}}
                    {{ index .Site.Data.ja.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ja.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "lv" -}}
                    {{ index .Site.Data.lv.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.lv.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}	
		           {{- else if eq .Site.Language.Lang "ro" -}}
                    {{ index .Site.Data.ro.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ro.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}		
		           {{- else if eq .Site.Language.Lang "ru" -}}
                    {{ index .Site.Data.ru.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ru.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "sl" -}}
                    {{ index .Site.Data.sl.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.sl.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}				
<!-- end of else-if, and change date to international/UK, rather than USA format -->					
                  {{ else }}
                    {{ .Date.Format "Monday, 2 Jan, 2006" }}
                  {{ end }}
                {{ end }}

I found this resource: https://www.w3schools.com/howto/howto_html_include.asp, but it seems to use JS to "include" other html, which is undesirable - it will probably break as soon as someone uses a legacy browser or NoScript. There must be a built-in way to do it in HTML or Hugo...

EDIT: Hugo should be the way to go, as the consensus from my research is that embedding repeated snippets of HTML requires either preprocessing (via PHP, Hugo or somesuch) or postprocessing, via JS in the user's browser. Maybe via index.Site.layouts._default.i18n to refer to i18n.html?

EDIT: Found the solution, will implement later: partials

Need to figure out if it's possible to reference within single.html and summary.html without extra JS, to save 3x37 lines.
@Darthagnon
Copy link
Contributor Author

Just realised the /docs readme is probably broken, as I put relative links in the main Readme, then copied it back. I'll fix this

…ted HTML; start fixing docs/README.md

Apparently / means "git repo root" in the markdown files, so docs/README.md should work now that I've added a / to a couple paths...?
@Darthagnon
Copy link
Contributor Author

Darthagnon commented Sep 22, 2021

Relative links in docs/Readme.md work :D Means we can use exactly the same readme for both files, without any unnecessary external links. Just need to use a / to indicate a path relative to git repo root (omitting this means path is relative to current folder and breaks). Need to see if I can use a symlink next... dunno if it will or not; I'm on Windows, using LinkShellExtension

@g1eny0ung
Copy link
Owner

I'm sorry I haven't followed this project for a long time.

I noticed that docsify now has this https://docsify.js.org/#/configuration?id=homepage, which allows us to remove docs/README.md safely.

@g1eny0ung
Copy link
Owner

Question: is it possible to put the whole i18n block within its own i18n.html file and reference it where required? Seems like it should be possible, but I'm not expert enough with HTML. Would save repeating the following 3 times:

| {{ if .Site.Params.Experimental.jsDate }}
                  <span data-format="luxon">{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</span>
                {{ else }}
                  {{ if eq .Site.Language.Lang "zh" }}
                    {{ index .Site.Data.zh.Weekday (printf "%d" .Date.Weekday) }},{{ index .Site.Data.zh.Month (printf "%d" .Date.Month) }} {{ .Date.Day }} 日,{{ .Date.Year }} 年
                  {{ else if eq .Site.Language.Lang "es" }}
                    {{ index .Site.Data.es.Weekday (printf "%d" .Date.Weekday) }}, {{ .Date.Day }} de {{ index .Site.Data.es.Month (printf "%d" .Date.Month) }} de {{ .Date.Year }}
                  {{ else if eq .Site.Language.Lang "pt" }}
                    {{ index .Site.Data.pt.Weekday (printf "%d" .Date.Weekday) }}, {{ .Date.Day }} de {{ index .Site.Data.pt.Month (printf "%d" .Date.Month) }} de {{ .Date.Year }}
                  {{ else if eq .Site.Language.Lang "fr" }}
                    {{ index .Site.Data.fr.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.fr.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
<!-- added some new language formatting alphabetically below this line. May have left out connecting words for languages I don't know; need native users to feed back -->			
		           {{- else if eq .Site.Language.Lang "ar" -}}
                    {{ index .Site.Data.ar.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ar.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "ca" -}}
                    {{ index .Site.Data.ca.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ca.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "de" -}}
                    {{ index .Site.Data.de.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.de.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}	
		           {{- else if eq .Site.Language.Lang "he" -}}
                    {{ index .Site.Data.he.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.he.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}		
		           {{- else if eq .Site.Language.Lang "it" -}}
                    {{ index .Site.Data.it.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.it.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "ja" -}}
                    {{ index .Site.Data.ja.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ja.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "lv" -}}
                    {{ index .Site.Data.lv.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.lv.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}	
		           {{- else if eq .Site.Language.Lang "ro" -}}
                    {{ index .Site.Data.ro.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ro.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}		
		           {{- else if eq .Site.Language.Lang "ru" -}}
                    {{ index .Site.Data.ru.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.ru.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}
		           {{- else if eq .Site.Language.Lang "sl" -}}
                    {{ index .Site.Data.sl.Weekday (printf "%d" .Date.Weekday) }} {{ .Date.Day }} {{ index .Site.Data.sl.Month (printf "%d" .Date.Month) }} {{ .Date.Year }}				
<!-- end of else-if, and change date to international/UK, rather than USA format -->					
                  {{ else }}
                    {{ .Date.Format "Monday, 2 Jan, 2006" }}
                  {{ end }}
                {{ end }}

I found this resource: https://www.w3schools.com/howto/howto_html_include.asp, but it seems to use JS to "include" other html, which is undesirable - it will probably break as soon as someone uses a legacy browser or NoScript. There must be a built-in way to do it in HTML or Hugo...

EDIT: Hugo should be the way to go, as the consensus from my research is that embedding repeated snippets of HTML requires either preprocessing (via PHP, Hugo or somesuch) or postprocessing, via JS in the user's browser. Maybe via index.Site.layouts._default.i18n to refer to i18n.html?

EDIT: Found the solution, will implement later: partials

This is related to go template. Hugo uses the native go template pkg to organize and render htmls.

@Darthagnon
Copy link
Contributor Author

Uh-oh. I implmented the block as a partial which sounded like it would work (but I haven't figured out how to test it, as I'm not sure how to change my locale for a test-site). Wondering if I've broken it?

I'm currently trying to get the time/energy to go through another branch I've got and make all JS load locally (my use-case involves offline websites, IPFS, and not wanting to depend on someone else's CDN). Thank you for the heads-up about the Readme! I'll change that, too

@Darthagnon
Copy link
Contributor Author

Pulled the latest changes into this branch; will do some testing.

Improve security by verifying SubResource Integrity (SRI) of Javascript delivered via remote CDN. Generated via https://www.srihash.org/ (alternative types, SHA-256 and SHA-512 are also available)
... in preparation for replacing remote CDN calls with local/relative URL calls.
Test NoScript warning in header, add Telegram sharing, Windows Explorer "Thumbs.db" to gitignore (in case of images)
... hugo serve -D just doesn't display them when testing locally (Hugo v0.96) [BUG?]
…roduction

# Conflicts:
#	README.md
#	theme.toml
Hugo Easy Gallery is better implemented as a universal Hugo plugin, and loaded alongside a main theme via the site config.toml
As such, Hugo Easy Gallery content is moved to https://github.com/Darthagnon/hugo-easy-gallery and all code and assets related to it have been removed..
Functionally identical, it just means less repeated code, and everyone can use it!
This brief experiment got me started on it, though!
# Conflicts:
#	README.md
#	layouts/_default/single.html
shorten allTags
shorten allCategories
switchTheme
change "flip" to "About"
rss /Subscribe!
check "update at" (for languages I can grok)
Groups
Re-add accidentally deleted YouTube thumbnail, Twitter screenshot, Instagram picture, Vimeo thumbnail.
Add relative links to rich-content-offline.md
Converted using Paint.NET
See Changelog.md for relevant links. May be possible to adapt this XSL for the Tags XML?
TODO: Change branding, add logos, relevant links to rss.xsl
un-minifying site.css with Notepad++'s JSTool broke the site layout. Narrowed it down between
056285a
and
ca403a8
@Darthagnon
Copy link
Contributor Author

Darthagnon commented Apr 5, 2022

So... er... I added a bunch of stuff @g1eny0ung. Most visible changes are:

  1. example site content
  2. Pretty RSS page
  3. new site params (documented)
  4. slightly reorganised and improved documentation

What do you think? I'll be pushing all these changes to my blog shortly, where you can see how they work: https://robot-one.github.io

@Darthagnon
Copy link
Contributor Author

Darthagnon commented Apr 6, 2022

Update: I've pushed the changes to my site if you want to see them.

It's not perfect, now that I have a chance to see it in production

Known issues, that aren't yet listed

  • scrolling/sticky header is broken EDIT: It was overlay scrollbars (probably CSS) that is vital to the site working properly.
  • single.html highlightjs block is still commented from earlier, I need to uncomment it.
  • nav themeswitch is missing alt text

@g1eny0ung
Copy link
Owner

NB: there is a copy of Readme (not updated) in the theme root

Both READMEs need to be updated, one for the hugo theme and one for GitHub.

, socials.toml should probably be filled with dummy data or moved to example site

I agree with placing dummy data to data/socials.toml. But it requires my personal information to be replaced with a placeholder, like xxx. 😌

, version-history.md can be merged with CHANGELOG.md?

And I also agree to place the version-history into CHANGELOG. This way only one file is maintained.

Question: is it possible to move all language data from data to i18n? Seems bizarre to separate weekdays from the rest of the i18n stuff.

Since we use .Site.Data in summary.html and single.html, these files have to be in the data folder. Maybe we could create data/i18n and put all the localization related files in there? That would be neater.

You've changed so much that I don't have a lot of energy to review these. 😢 This PR has been open since last year, and I noticed that the comments that were once at the beginning were not processed, so I couldn't merge this PR directly.

May I suggest breaking this big PR into smaller PRs? It would be more helpful to track each new feature.

@Darthagnon
Copy link
Contributor Author

Hey, sorry for the overwhelming amount of things. I'll try and split it up sometime this coming week.

tbh I suspect it looks worse than it actually is - I worked with 2-3 branches, "intended" for features, but then a couple of them the features didn't work, so I just did an undo and merged in small changes to the main branch (which is now far beyond just improving the readme).

If I can figure out git, I'll be splitting it roughly into:

  • improve readme
  • improve localisation
  • load JS from CDN or locally
  • TODO: probably 1 branch for each new site param?
  • misc. fixes

@stale
Copy link

stale bot commented Jun 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the outdated label Jun 10, 2022
@Darthagnon
Copy link
Contributor Author

Darthagnon commented Jun 11, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Bad bot. I'm still working on it, and working on my website. Got some more things I've been experimenting with on another theme and fixes I want to implement. And I've (sorta) learned how to cherrypick commits, which I'll have to do to split it up again 😟


Wish I could get my head around organising my pull request. Can't figure out the best way to split it up, might just have to make my version a hard fork. I merged all my branches with a hundred or so commits into one, so as not to open loads of pull requests :'(

@stale stale bot removed the outdated label Jun 11, 2022
@stale
Copy link

stale bot commented Sep 22, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the outdated label Sep 22, 2022
@stale stale bot closed this Sep 30, 2022
@Darthagnon Darthagnon mentioned this pull request Aug 13, 2023
@g1eny0ung g1eny0ung reopened this Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants