Commit Graph

39 Commits

Author SHA1 Message Date
Collin J. Doering 9171aa88ad
Replace broken piwiki analytics with self-hosted plausible
* templates/partials/analytics.html: Upon a client load of the website, determine which site
they are viewing (dev, staging, production) and setup plausible analytics appropriately.

* templates/default.html: Remove non-functional piwiki script reference and replace with a
reference to the new partial template for analytics

* src/site.hs (main): Remove remnant of application cache support

* js/default.js: Remove unneeded analytics code specific to piwiki. No additions were made here in support of plausible

* TODO.org: Mark associated TODO item DONE
2021-12-18 20:37:59 -05:00
Collin J. Doering d6464b8ac7
Remove application cache functionality now that its deprecated 2021-11-27 23:43:22 -05:00
Collin J. Doering de27657196 Fixed active nav item issue
The navigation was working correctly before the javascript refactor, and
seemed to be working correctly after as well, except when clicking on
links to tag pages or posts from within #page-content. When an internal
link to a post or tag page is clicked the navigation should set the
"blog" menuitem to be active. Unfortunately, this was not the case
before this commit but luckily this commit rectifies this.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2016-02-08 19:39:10 -05:00
Collin J. Doering f026829d1c Complete refactor of js/default.js
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2016-01-17 05:30:04 -05:00
Collin J. Doering 32d3101989 Add piwik script in html instead of dynamically
Instead of adding the piwik javascript dynamically in javascript, add it
using a script tag in "templates/default.html".

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2016-01-17 05:30:04 -05:00
Collin J. Doering 0d7faa8d8f Encapsulate analytics code using module pattern
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2016-01-17 05:30:04 -05:00
Collin J. Doering e7decd4349 Initial commit to branch upgrade-js
Start incrementally adding to sites javascript. Starting with, handling
application cache events, then considering additional features like
using local storage to allow offline reading of posts, as well as an
interface to view and manage them.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2016-01-17 05:30:04 -05:00
Collin J. Doering c2aefc647f Remove unused class "loading-done"
The class "loading-done" is unused and should have been removed in
commit bc1cfaabeb.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2016-01-17 05:30:04 -05:00
Collin J. Doering a37aedc45b Updated href used to find blog navigation item
Due to pagination, the first page of the blog is routed to "/blog1.html"
and this href is used in the navigation as well. Thus to set the blog
navigation menuitem to active, the href needed to be updated.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 03:10:40 -04:00
Collin J. Doering 97d4bff5cd Site working with or without javascript
Now uses history.pushState as a replacement for jquery-address.

Links to blog and tag pages are broken currently; see TODO.org for
details.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering c5803970bd Removed extra spacing from js/default.js
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering b065448a26 Removed jquery-address
Note: The sites javascript doesn't work currently as jquery-address has not
yet been replaced by the history api. This however doesn't stop users
from viewing the site, the javascript just errors out in the background
for users who have it enabled.

See TODO.org for more details of what needs to be completed

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering 0902730137 Removed use of virtualpath contexts
Now because all URLs are now valid urls, and no special treatment of
pages is required the following changes were made:

* Removed rel attribute from navigation anchor tags in
  "templates/partials/nav.html"
* Removed use of virtualpath context and associated pagination code
  associated with virtual paths in "src/site.hs"
* Removed unneeded bloat from "templates/paritals/paginate.html" because
  irtualPaginateContext is now no longer needed

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering bc1cfaabeb Removed init and loading-error css and logic
Because all pages are complete pages that can be viewed with or without
javascript, the 'init' and 'loading-error' classes should not be set on
the '#page-content' div. Similarly the 'loading' class should not be set
on '#nav'. All associated logic and css for the 'init' and 'loading'
classes is also unused. This commit removes the aforementioned.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering a21fe60c9e Fixed js page loading issue
Load html using $.parseHTML so that no scripts are executed, otherwise
all scripts are loaded each page load and ajax load which causes an
infinite loop.

Currently, though everything is functioning, there are a few
deficiencies. See TODO.org for more details.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering e634f0fbe4 Consolidated default and nojs versions of site
Removed old nojs specific templates and updated "templates/default.html"
and "templates/partials/nav.html" to support nojs. All pages now use
relativized urls. Navigation pages (including blog paginated pages) are
generated to "/" instead of "/pages/".

Site now works when javascript is disabled. Unfortunately, it no longer
works when javascript is enabled. This is due to the client side router
but needs to be debugged further.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:14 -04:00
Collin J. Doering 05bdb874fc Setup Piwik analytics
Setup Piwik tracking of page loads. The global array _paq is used to
communicate commands to the piwik tracker via the script piwik.js which
is loaded asynchronously from the analytics server. Every time a ajax
call is made successfully and content is loaded in the page, analytics
data is captured and sent to the tracker (the loadPageContent function).

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-05 06:55:48 -04:00
Collin J. Doering 1d8e0a5587 Fixed status message behavioral issues
Now displays multiple error messages one after the other. Also fixed an
issue where when there is a status message being display and another
error happens, the status message slides up then down again with the new
message.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-07-06 21:41:20 -04:00
Collin J. Doering 072e3d9870 Themed post content (tables, images, figures, code)
Added theming for tables, inline images, and figures. Inline images are
specified using the markdown syntax "![link text](link_href)" somewhere
within a paragraph. When a link is specified with the same syntax given
previously, Pandoc will generate it as a figure. Figures are displayed
across the whole width of the post and inline-images floated to the
right. Some javascript was added to js/default.js to enable the ability
to click to toggle fullscreen on images and figures.

Code blocks were previously themed but the styling needed to be updated
due to how an update to how pandoc generates code blocks.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-07-06 21:41:20 -04:00
Collin J. Doering 0bb23967c0 Stop once recursion depth has been reached
While testing I had the router allow infinite loops, but had support all
along to stop them if they occur. Though a message signaled to the user
using a status message would be mice, currently just log to console.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-02-01 03:22:18 -05:00
Collin J. Doering 1866ea9aa6 Fixed redirect loop issue on firefox
In firefox, when going to site from another page was unable to go back.
The exact reason this happens in firefox and not in chromium is still a
mystery.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-02-01 03:19:31 -05:00
Collin J. Doering 4db3cb536c Fixed passing of most jslint checks
The only checks that fail are the 'insecure regexp' checks (which in
this case are not insecure) as well as a few functions that take unused
parameters.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-23 14:33:24 -05:00
Collin J. Doering bfa6e42d9f Cleaned up client side router
Wrapped client side url router in a function that returns an object (the
interface for the router). Because javascript passes by reference,
passing the array of handler/route objects to the router was an issue
so the array of routes used for this application was moved to within the
wrapper function. In the future this should be changed so
the array is supplied and can be modified with a method like addRoute.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-23 14:33:24 -05:00
Collin J. Doering 07eb14f986 Added initial implementation of client side router
Re-factored how urls are handled. Specifically, made it more clear which
urls are rewritten when as well as what to run beforeSending, onError
and onSuccess.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-23 14:33:24 -05:00
Collin J. Doering 3df2f3df34 Cleaned up client side URL rewriting
When a page listed in the navigation was opened in a new page/tab, the
url used to be the whole path (/#/pages/pagename.html). This commit
enables rewriting of the urls (using jquery address) so that the client
always sees a pretty url (eg /#/blog.html instead of
/#/pages/blog.html).

Also fixed issue introduced last commit (b6d6830) where when clicking on
post or tag links failed to activate the blog menuitem.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-22 13:35:58 -05:00
Collin J. Doering b6d683014d Fixed opening nav items in new tab/window
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-22 01:07:48 -05:00
Collin J. Doering e2fd291e8f Fixed opening issue with links within page-content
Previously, all anchor clicks within #page-content was handled by a
event listener that checked whether the anchor's href was to an
'external' url and if so loaded it directly. Otherwise it passed the
value of the anchors href attribute to the jquery address plugin (via
the $.address.value function).

This unfortunately cause clicking on anchors to work fine but when
opening them in a new page or window (or copying the link) caused the
link to reference the html snippet of the page/post instead of the
entire application.

To rectify this, this commit simply transforms internal urls href
attribute after the snippet is loaded into #page-content.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-22 00:24:52 -05:00
Collin J. Doering 046f97a2bb Passes most jslint tests
Excluding insecure regexps (used to check urls - which is not a security
risk in this case). In a future commit this can be fixed by adding
comments ignoring the jslint errors or by making the regexps more
specific.

Also in the ajax call in loadPageContent the callbacks fore beforeSend
and error have unused parameters (xhr and settings, though the error
callback uses its second argument status).

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-19 23:53:38 -05:00
Collin J. Doering 9a9630435b Fixed handling of internal image urls within page-content
When an anchor within #page-content has a href matching /images\/.*/ it
should be viewed as a resource for download/view instead of loaded into
$page-content.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:29 -05:00
Collin J. Doering 06b4752bee Fixed a couple comments in site javascript
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:29 -05:00
Collin J. Doering 5bbacb1725 Added initial implementation of error messages
Cleans up error reporting when an ajax call fails, and thus
the #page-content div can't be filled. This is accomplished by using
a #status which has a p.message element that can be populated for text
displaying status messages. By adding either .error or .success
to #status causes it to be highlighted as either a error or success message
respectively.

When its the first load of the page, and #page-content hasn't yet been
populated with content, an error message is shown in the #page-content
div.

Removed the /posts/ and /tags/ fallbacks in the generated
manifest.appcache because even when online, ajax calls for invalid URLs
under those paths return the respective fallback page instead of an
error message, and populate the #page-content div with the fallback. So
from this point forward the fact that the website is offline will be
handled from JavaScript.

When a page is not accessible in the application cache and the user is
offline, an error message is displayed using the mechanism mentioned
above.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:29 -05:00
Collin J. Doering 891fadf3a2 Paginate tag pages
Paginate tag pages, allowing maximum 2 pages per tag to be app cached.
Setup virtual paths for tag pages such that /tags/tagname.html loads
/tags/tagname1.html similar to how pages are handed. This is similar to
how pages are handled in that /pagename.html loads /pages/pagename.html.

Dry up blog page's pagination and create a dry template for pagination
because it is also used on the tag pages.

Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2015-01-14 04:50:28 -05:00
Collin J. Doering 496e0d5396 Bump to Hakyll 4.6 and clean up
Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2015-01-14 04:50:28 -05:00
Collin J. Doering 001d4c05f0 Finished up pagination and cleanup
Paginate URLs now working correctly. In posts and pages a link to a page can be given
using either:
 - absolute url (eg. /pages/somepage.html)
 - virtual page path (eg. /#/somepage.html)

This is achieved in js/default.js by treating a tags with the rel
attribute as virtual. Specifically, the rel attribute should be of the
form "address:/virtual/path.html" , though this isn't tested for. If a
value val, is found in the rel attribute then it is used as the URL in
loadPageContent where if it doesn't match certain regexps it is assumed
to be a page and "pages" + val is loaded into the page-content div. See
loadPageContent for more details.

Placed first page, previous page, next page, and last page links at
bottom of blog pages to switch between pages.

Still incomplete:
 - pagination menu needs to be further styled with images, tool tips, etc.
 - check if rel conforms to the form /address:.*/ and if not don't treat
   is specially (as virtual)

Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2015-01-14 04:50:28 -05:00
Collin J. Doering a0aed31d54 Pagination working but still needs to be cleaned up
- pagination of posts now works (they are output to pages/blog<n>.html
  where <n> is a number from 1 to some natural x)
- pages in pages/* are weighted 1 to some natural y for the purposes of
  generating the menu; but now items that are weighted 0 will not show
  up in the menu and instead will be hidden. This allows for the
  paginated pages to be generated to _site/pages/blog<n>.html as above
  but also avoids showing them in the generated menu.

Now there still is the issue of showing the pages. js/default.js has
been slightly modified to allow the new format of the paginated blog
pages along with the original blog page.

Things yet to complete for pagination:
- the original blog page still needs to be removed as it will be
  replaced by the paginated pages
- need to modify templates/partials/post-teaser-list.haml to show the
  forward/backward buttons from the paginate context.
- paginate tag pages
- find a clean way for the paginated pages (blgo and tags) can be
  viewed/selected

Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2015-01-14 04:50:28 -05:00
Collin J. Doering dc814507cc Further various fixes and improvements
- fixed path of gitsubmodules
- added folder 'files' for files that are not to be App Cached
  and included my public gpg key
- did a little work on the business card (displayed on the home page and
  contact page
- changed app cache fallback pages to be in haml instead of html

js/default.js:
  - added support for mailto and download-able (not app cached) links
  - added support for mathjax (called on each call of 'loadPageContent')

site.hs:
  - added support for using arbitrary pandoc reader/writer extensions
  - added support for rendering of maths (using mathjax)
  - added generation of tag pages to the application cache (a fallback
    is still used for the rss feeds as they are not necessary while
    offline)

TODO:
  - pagination (n posts per page)
  - save n most recent posts to localstorage and support option to
    add/remove posts
  - add general fallback page to handle main rss feed and other files
  - content and styling

Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2014-03-12 20:59:58 -04:00
Collin J. Doering 3a7e6b5e4a Variety of changes; see log for more details
Almost ready for prime time. What remains to be completed is as follows:
 * pagination
 * fix the escape parsing bug in the section parser
 * add support to locally cache posts (opt-in)
 * clean-up the code
 * finish contact page and home page

The following was completed since last commit:
 * added gpl.txt to project
 * deleted otf free fonts to save space
 * various structural changes
 * added a new post 'first-post'
 * various ascetic changes to templates and sass code
 * used function to remove js from global namespace (js/default.js)
 * added support for application cache and generating a cache manifest
 file (site.hs) as well as created appropriate fallback .html
 files '{post,tags}-fallback.html'

Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2014-03-05 18:20:03 -05:00
Collin J. Doering 512e89f565 Major changes! See full log.
* Changes

** Hakyll "site.hs"
*** Added the ability to have per-page templates (for all "pages/*")
*** "pages/*" can now be sectioned off into blocks
    A section is a logical division of a page. It removes the requirement
    for pages that have multiple sections to have some html in the
    markdown for the page or to move some of the markdown content to the
    template. Both of which are un-maintainable.

    There are two types of sections, both with slightly different syntax's.

    A _global section_ is a section who's content will be included in all
    sections (regardless of ordering). This is handy for including links
    and footnotes that might be needed in more then one section or
    non-section . It is not accessible from the Context obtained from
    genSectionContext. To indicate where a global section begins and ends
    use "$section$" and "$endsection$" respectively (without
    quotes). Formally:
                       $section$ <body> $endsection$

    A _named section_ is a section of a document that can be accessed by a
    given name from the context obtained from the function
    genSectionContext. To specify a named section use the following syntax:
                  $section("<name>")$ <body> $endsection$
    where <name> is the name of the section (any character except \")
      and <body> is the section body

    Anything that is not a section is referred to as a non-section. These
    are still important as they will include all
    content of the global sections of the document as well as the
    non-section itself. To be a little more formal a non-section is
    everything between "$end-section$" and ("$section$ or
    $section("<name>")$").
**** Example: mypage.markdown
     page title
     ==========
     $section("column-one")$
     This is text that can be formatted in the individual page template
     located at "templates/pages/mypage.haml". Here is a link from a
     global section. See [Home][].
     $endsection$
     This is some text in between two sections or a section and the top or
     bottom of the page. It can be accessed by $body<n>$ where <n> its
     position from the top of all non-sections starting from 0. Here i can
     also use
     $section$
     [Home]: http://blog.rekahsoft.ca
     $endsection$
***** To see more visit
       - "pages/<name>" where the sectioned page markdown is written
       - "templates/pages/<name>.haml" where the individual page
         template is stored/loaded from
       - "templates/page.haml" the generic page wrapper

** Miscellaneous
*** Reorganized the file structure
     - created folder "image-src" for image-sources
     - created folder "lib" for libraries that will be needed on the server
     - moved jQuery and Skeleton to lib and made appropriate
     - created folder "fonts" for FreeMono and FreeSans font files which are
       now used via css @font-face
     - create folder "css" and setup "site.hs" to minimize all css files
       and publish them to idRoute
     - created folder "sass" which contains a variety of s[ac]ss files along
       with a file named "default.s[ax]ss" which will be processed by sass
       to include any other s[ac]ss files that are needed and output
       "default.css" to the site root
*** cleaned up .gitmodules

** Javascript
   - fixed processing of urls
   - temporarily disabled nojs version of site as its under heavy development
     Note: still need to merge changes made to default version into the
     nojs one; specifically having "templates/pages/*.haml" be applied to
     there respective page before "templates/page.haml" is applied to the
     result

** Styling
   - switched to using sass (with a side bourbon) instead of css
     leaving css folder and processing for convenience
   - slimmed the site of the nav-loading image
   - updated favicon (rounded corders, preparing to support more sizes)
   - updated the logo-banner
   - added new images for tab page

** Templates
   - converted all "templates/**" to haml and made the apropriate
     adjustments in site.hs
   - added "templates/pages/*" which contains individual templates per
     page in "pages/*"

** Known Issues
**** Sections cannot contain $section$ or $section("<name>")$ or $sectionend$ in them (this is an issue with escaping in the parser)
**** pagination has been attempted but no solution yet
**** haven't been able to generate two sets of tag-pages (one for the default version and the other for the nojs version
**** opening a internal link in a new tab in any browser will load the snippet that would normally loaded by by ajax

Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2013-12-10 23:31:48 -05:00
Collin J. Doering 610d11903b Hakyll configuration primarily complete.
All changes are detailed below. Both the ajax (default) and nojs version
are being generated properly. Remaining tasks include:
 - theming (css - both versions)
 - additional work on the templates (both versions [where applicable])
 - writing content (used by both versions but only one copy needed)
 - writing addition js where needed (for default version only)

Changes:
  .gitmodules: added/fixed git submodules; uses bootstrap and jquery-address
  css/default.css: various minor modifications to make things look sane
  index.html: home page for default version of site
  js/default.js: minor modifications to enable carousel and loading of content with ajax
  news/*: A bunch of bogus news articles to test the generation of the site
  pages/*: All pages are written here. Giving a 'weight' in the metadata will be used to order
    the navigation.
  site.hs: Many changes..see the source. Mostly complete (perhaps consider doing a screen
    reader version of the site)
  templates/*: Did various work thoughout the templates (including splitting up some between
    the different versions (noted by templateName-versionName)
      templates/archive.html
      templates/default-nojs.html
      templates/default.html
      templates/footer.html
      templates/nav-nojs.html
      templates/nav.html
      templates/news-nojs.html
      templates/news.html
      templates/page.html
      templates/post-list.html
      templates/post.html
      templates/recent-news-nojs.html
      templates/recent-news.html
2013-11-02 21:08:00 -04:00