Commit Graph

46 Commits

Author SHA1 Message Date
Collin J. Doering 44094948cf
Update site script and hookup hakyll static file deploy
Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>
2018-12-15 21:58:18 -05:00
Collin J. Doering c053c6a3ed
Use stack to run gencss (clay pre-processed css)
Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>
2018-12-15 21:58:16 -05:00
Collin J. Doering c0498bff65
Initial work blowing the dust off this codebase
This primarily includes updating dependencies, and using stack for sane dependency management.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2018-12-15 21:57:29 -05:00
Collin J. Doering 975f6c42ee
Remove jsmin dependency from build process
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2017-04-23 22:19:19 -04:00
Collin J. Doering e91eba5dfb
Update deployment to use cloudfront and s3
Bootstrap the environment using:

./site init-env <stack-name> <cf-bucket> <cnames>

- stack-name :: is the stack name used for the infrastructure bootstrap cloudformation template
- cf-bucket :: is the name of the S3 bucket that holds the cloudformation stack that will bootstrap
the environment
- cnames :: is a comma separated list of domains to be used as CNames with this deployment

Note: this can also be run directly with ./init-env.sh

Once the environment has been bootstraped, the site can be deployed using the variables given
in its output.

AWS_DEFAULT_REGION=<region> \
AWS_ACCESS_KEY_ID=<access-key> \
AWS_SECRET_ACCESS_KEY=<secret-key> \
S3_BUCKET=<s3-bucket> \
./site deploy

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2017-04-23 21:45:27 -04:00
Collin J. Doering d16c970ae2 Removed unused "weight" context
The constField "weight" is no longer needed to be set to zero when
generating blog pages because the paginated pages are no longer captured
when generating the navigation (context).

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 03:10:40 -04:00
Collin J. Doering 16a5e700cd Don't appcache posts, tag and blog pages (>2)
Add context for appcache that can be detected in templates, which is
used to avoid appcaching post pages, as well as used to appcache only
the first two pages of the blog and for each tag.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 03:10:40 -04:00
Collin J. Doering 339126bfc7 Moved tag pagination code out of function
Refactor tag pagination function paginateTagsRules into main as it is
only ever needed/used once.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 03:10:40 -04:00
Collin J. Doering a879dded4b Fixed paginated tag links
Though this commit is only a one character modification to src/site.hs,
its result is subtle. The identifier of each tag page must be routed to
the first page of its paginated pages, respectively. E.g the tag
"general" must have route "tags/general1.html" as to match up with the
actual output of paginating the tag pages.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 03:10:00 -04:00
Collin J. Doering 5719cc5dc9 Update site script and remove %site symbolic link
Refactored and cleaned up site build script. Use cabal to run executable
instead of through the link %site. Added options for running
cabal commands clean, configure, and build via options clear, configure,
and make respectively. These different names were used as to not reuse
ones already in use by the hakyll generated site binary.

Update deploy code in src/site.hs as there is no need to remove empty
files anymore as they are no longer generated.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering 5e9ff21813 Fixed blog pagination link issue
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 a4b3d3d35e Moved pages/home.markdown to pages/index.markdown
This removes a special case when generating the pages. Namely having to
change the route of "pages/home.markdown" to "pages/index.markdown"
before being converted to its final route of "/index.html".

Note: Because "pages/home.markdown" was renamed, its template
"templates/pages/home.html" has also been renamed to
"templates/pages/index.html".

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering 316ac7fd2d Consolidated repeat code for generating navContext
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering 375dbcfc74 Fixed Tag pages pagination artifact
Given a tag with name "gen", only "tags/gen1.html" through
"tags/genN.html" should be generated. Before this commit, an addition
file was unwittingly generated for each tag, which contained all posts
tagged with that tag (in the case of tag "gen" it would have generated "tags/gen.html"
which contains all posts tagged "gen").

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering deb81e9cbd Fixed double entry of /index.html in manifest
Because index.html is now generated as part of the "pages/*" rule (via
"pages/home.html") and there is no shell index page which then is filled
with content using javascript, "index.html" does not need to be listed
explicitly for manifest.appcache generation.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -04:00
Collin J. Doering 53c782d5ab Cleanup spacing/formatting in src/site.hs
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-16 02:15:26 -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 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 e5a90c220e Fixed blog paginate page links in manifest
Since paginated pages for the blog are now generated to "/", update
"/manifest.appcache" accordingly.

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 0410e41e11 Fix nojs navigation hrefs
Because the metadata of pages/* is needed for generating pages/* itself,
and for posts/**, it must be preprocessed. This is done in the version
"nav-gen" but because the pages are not given a route, they have an
empty $url$ field within templates. That is, when a list of pages is
retrieved and used to generate the navigation, they have no url field,
thus breaking navigation. Specifying the same route for both solves this
problem, as the final version depends on the preprocessed version and
thus will be the final result.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-10 17:35:46 -04:00
Collin J. Doering 4eaf774f11 Minor changes and cleanup to nojs version
Unfortunately, tags do not seem to be working correctly. That is:

* Nothing seems to be generated to the expect spot
  _site/nojs/tags/*.html
* tagcloud for tagsNoJs is empty
* tags are displayed on post pages but are not hyperlinked

Currently why this does not work is unknown.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-10 16:56:43 -04:00
Collin J. Doering c535ebde58 Removed unused nojs/archive rule and template
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-10 16:56:43 -04:00
Collin J. Doering d8c7e54aaa Partly working NoJs site
Updated nojs site as the code became stale over time as a comment. Nojs
site now mostly works, excluding the following issues:

* Navigation links have no href.
* Tags do not seem to work; the tagcloud that is displayed on the nojs
  homepage references the tags for the main site and tags aren't
  displayed in posts. The cause for this is not yet known.
* Unused templates that are nojs specific can be removed:
  * templates/archive.html
  * templates/partials/post-nojs.html
  * templates/partials/recent-posts-nojs.html

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-10 16:56:43 -04:00
Collin J. Doering 8997f122b5 Uncommented old nojs site generator code
Also updated the name of template files from *.haml to *.html as haml is
no longer used for html templates.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-10 16:56:43 -04:00
Collin J. Doering 92acb5344e Add robots.txt for web robots
Allow all robots to access any part of the site. This may change in the
future, as the html snippets that are generated for the posts and pages
should not be directly indexed.

See: http://www.robotstxt.org/robotstxt.html

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-08-05 02:42:12 -04:00
Collin J. Doering ecc75e6375 Removed old nojs comments from src/site.hs
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-07-11 03:12:05 -04:00
Collin J. Doering 519f3833bf Upgraded Hakyll 4.6 -> 4.7
The type of the function `readPandocWith` changed slightly between
versions. This commit fixes the minor issue it caused.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-07-03 03:02:12 -04:00
Collin J. Doering 039a961217 Fix ghc warnings generated when compiling src/site.hs
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-02-18 03:13:38 -05:00
Collin J. Doering 5ddd857e79 Cleaned up './site deploy' output
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-30 04:49:02 -05:00
Collin J. Doering 917775a909 Updated site deploy commands
Now when './site deploy' is run the empty files that are left over from
Hakyll generating the site are removed. Also rsync now uses verbose
output so that its easy to see what files are updated on the server.

Note, because the commands run by './site deploy' include 'echo' and
'find' this requires a posix environment (and thus can't be built on
Windows without cygwin).

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-25 00:00:55 -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 d5f2f56ec4 Completed porting haml templates back to html
Removed all haml templates and returned to using the default hakyll
style html templates. The main reason for this was to avoid the
requirement for external tools that cannot be installed with cabal. Also
as much as haml is nicer to read and write (in my opinion) it is in this
case just adding another layer of needless abstraction.

Perhaps in the future haml-like functionality can be added to default
hakyll templates. Until then, follow the KISS mentality.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:29 -05:00
Collin J. Doering 4b8c5a8c04 Fixed some comments and a false mention in the README
I was thinking of using hamlet for templates but hadn't implemented
anything yet. Using hamlet doesn't work well in this case though because
hamlet templates are compiled (using template haskell). Removed this
false mention from README.md.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:29 -05:00
Collin J. Doering 23ad19ffa6 Cleaned up src/site.hs fixing most ghc warnings
Only two ghc warnings remain; that is:
* defaulting a type to integer (line 476)
* discarding the result of a do-notation statement (can be turned off
  with the -fno-warn-unused-do-bind option (line 502)

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:29 -05:00
Collin J. Doering 81c675f7b4 Fixed clay css output issue
Added the --verbose=0 option when "cabal run gencss compact" is run from
src/site.hs. This stops cabal from outputting compiler/success messages
to the front of the generated css file.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:29 -05:00
Collin J. Doering c64af63d82 Switch from sass to clay for css pre-processing
Removed dependency on sass in src/site.hs and replaced it with clay.
This is achieved by adding a second executable to the projects cabal
file (called 'gencss') and a folder (called 'clay) that contains all .hs files for
clay (nested however deeply). Then whenever the site is being built, the
"cabal build gencss" command is run, which if successful is followed by
"cabal run gencss compact" whose output is captured and saved to
/default.css.

The sass folder has been left while the majority of the sass has not
been ported over to clay. Only part of sass/default.sass has been ported.

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 0bf8f8a6a1 Remove repeated copyFileCompiler Rules
Instead use a single pattern (providing the route also remains
unchanged; that is, idRoute)

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-01-14 04:50:28 -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 5a23b9c90a Fix whitespace in src/site.hs
Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2015-01-14 04:50:28 -05:00
Collin J. Doering c1c82e397f Don't appcache empty file pages/blog.html
This causes a bug when using the android browser. Specifically, because
pages/blog.html is appcached it always prefers the appcached version and
thus loads an empty blog (unless you explicit request pages/blog1.html)

This empty file is required while generating the navigation. There seems
to be no way to not write a file once within the Rules monad (or at
least it's not simple).

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 7e33aa7fe5 Initial cabalization of site
Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
2015-01-14 04:50:28 -05:00