Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

This is a PR based on Issue #34: adding blog functionality #42

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 55 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,71 @@ All icons using Fontawesome's icon font. Look at the website of [Fontawesome](//
Beside the config file, there is in `data` another subfolder called [`projects`](//github.com/digitalcraftsman/hugo-creative-theme/tree/master/exampleSite/data/projects) which hosts the files that will appear as your projects in the portfolio section. Such a project file might look like [this one](//github.com/digitalcraftsman/hugo-creative-theme/blob/dev/exampleSite/data/projects/2014-07-05-project-1.yaml) written in YAML:

```yaml
modalID: 1
title: Project 1
date: 2014-07-05
img: 1.jpg
client: Start Bootstrap
clientLink: "#"
title: Project Title
date: 2017-10-13
img: projectImage.jpg
link: "https://linkto.project"
category: Web Development
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel enim aliquid dicta ullam in repellendus amet perspiciatis adipisci architecto obcaecati sit voluptas ipsam, deleniti neque placeat tenetur cum tempore velit.
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit.
```

Copy the folder [`projects`](//github.com/digitalcraftsman/hugo-creative-theme/tree/master/exampleSite/data/projects) inside the `data` folder in the **root** directory of your site. Let's make some changes to show your work.

Pay attention to the `modalID`. It must be a unique integer and be incremented with each new project you want to add to the portfolio. Otherwise, the corresponding modal can't be rendered.

Furthermore, you can use Markdown syntax for URLs like here `[text](//url.to/source)` in the description.

To give your projects an image, save those under [`static/img/portfolio`](//github.com/digitalcraftsman/hugo-creative-theme/tree/master/static/img/portfolio). The dimensions should be 650 x 350 pixels. Don't forget to set the **filename** under 'img' in your project.

### Blog

This theme has been extended to feature a blog. Within the config file, the blog can be enabled/disabled by uncommenting/commenting the `params.blog` option and it's options.

Specific features can be enabled and disabled via the config:

- `showHomeSection` - Shows the blog section on the homepage. (Default: `true`.)
- `showHomePosts` - Shows the first 4 latest posts within the blog section. (Default: `true`.)
- `showHomePostExcerpts` - Show post excerpts on the homepage. (Default: `true`.)

Newly created posts look like this:

```markdown
date: 2017-10-11T03:14:31-04:00
title: "Hello World, This is My First Post!"
description: "This is my very first post on the blog."
author: "Your Name"
featured_image: "/images/post-featured-image.jpg"
draft: true
---
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel enim aliquid dicta ullam in repellendus amet perspiciatis adipisci architecto obcaecati sit voluptas ipsam, deleniti neque placeat tenetur cum tempore velit...
```

On the blog article pages, the header will be filled in with the `featured_image` link. If it's empty, it defaults to a solid color.

To let blog posts be published just set the `draft` meta tag to false.

Although the blog can be "disabled" on the front-end, it can't be completely disabled. It will be hidden, but it's still reachable via direct links. This is a limitation of Hugo itself, unfortunately. Until the ability to enable/disable sections is built in, this will continue to be a limitation.

### Blog Pagination

The main blog page has a pagination function to only show a certain number of posts today. This can be found within the `config.toml` file in the `Pagination` property. For the purposes of the example site it's set to 3. However, this value can be modified to show any number of posts per page.
### Footer Copyright and Links

The footer copyright mark uses the automatic current year and `name` parameter set in `config.toml` to generate the statement. This functionality can be changed in the `footer.html` partial template.

Footer links are generated the same way the primary navigation links are. To extend it, just modify the parameters under the `params.footer.nav` parameter in `config.toml`. The typical structure for it is as such (where `name` is the name of the link):

```markdown
[params.footer.nav.name]
text = "Display Text"
link = "https://link.address"
```

Once it's been added to the config, it must also be added to the `footer.html` partial within the list contained within the `footer__links` div, using the following structure:

```markdown
{{ if and .Site.Params.footer.nav .Site.Params.footer.nav.name }}
<li><a href="{{ .Site.Params.footer.nav.name.link }}">{{ .Site.Params.footer.nav.name.text }}</a></li>
{{ end }}
```
### Nearly finished

In order to see your site in action, run Hugo's built-in local server.
Expand Down
8 changes: 8 additions & 0 deletions archetypes/blog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
date: {{ .Date }}
title: "{{ replace .TranslationBaseName "-" " " | title }}"
description: ""
author: ""
featured_image: ""
draft: true
---
1 change: 1 addition & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+++ date = "" title = "" description = "" featured_image = "" +++
1 change: 1 addition & 0 deletions archetypes/projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+++ title = "" date = "" img = "" client = "" link = "" category = "" description = "" +++
Binary file added exampleSite/.DS_Store
Binary file not shown.
26 changes: 25 additions & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
baseurl = "https://example.org/"
baseURL = "http://myexample.com"
languageCode = "en-us"
title = "Hugo Creative Theme"
theme = "hugo-creative-theme"
googleAnalytics = ""
Paginate = 3 # Post pagination for the main blog page.

[params]

Expand Down Expand Up @@ -35,6 +36,7 @@ googleAnalytics = ""
about = "About"
services = "Services"
portfolio = "Portfolio"
blog = "Blog"
contact = "Contact"


Expand Down Expand Up @@ -105,3 +107,25 @@ googleAnalytics = ""
# latitude = "34.007850"
# longitude = "-118.499305"
# maps_api_key = ""

# Blogging Feature
# Comment out to disable the blog completely (links still work unfortunately).
# Set sections to false to disable them.
[params.blog]
showHomeSection = true
showHomePosts = true
showHomePostExcerpts = true

# Footer Navigation
[params.footer.nav]
[params.footer.nav.terms]
text = "Terms & Conditions"
link = "http://google.com"

[params.footer.nav.privacy]
text = "Privacy Policy"
link = "http://apple.com"

[params.footer.nav.contact]
text = "Privacy Policy"
link = "/#contact"
7 changes: 7 additions & 0 deletions exampleSite/content/blog/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
date: 2017-04-09T10:58:08-04:00
description: "Collection of Posts"
title: "Blog"
---

A collection of my posts.
29 changes: 29 additions & 0 deletions exampleSite/content/blog/chapter-1-mowglis-brothers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
date: 2017-10-11T03:32:10-04:00
title: "Chapter 1: Mowgli's Brothers"
description: "The Jungle Book"
author: "Rudyard Kipling"
featured_image: "/images/chapter-1-mowglis-brothers-img.jpg"
draft: false
---
![Mowgli's Brothers](/images/chapter-1-mowglis-brothers-img.jpg)

Now Rann the Kite brings home the night
That Mang the Bat sets free--
The herds are shut in byre and hut
For loosed till dawn are we.
This is the hour of pride and power,
Talon and tush and claw.
Oh, hear the call!--Good hunting all
That keep the Jungle Law!
-- Night-Song in the Jungle

It was seven o'clock of a very warm evening in the Seeonee hills when Father Wolf woke up from his day's rest, scratched himself, yawned, and spread out his paws one after the other to get rid of the sleepy feeling in their tips. Mother Wolf lay with her big gray nose dropped across her four tumbling, squealing cubs, and the moon shone into the mouth of the cave where they all lived. "Augrh!" said Father Wolf. "It is time to hunt again." He was going to spring down hill when a little shadow with a bushy tail crossed the threshold and whined: "Good luck go with you, O Chief of the Wolves. And good luck and strong white teeth go with noble children that they may never forget the hungry in this world."

It was the jackal--Tabaqui, the Dish-licker--and the wolves of India despise Tabaqui because he runs about making mischief, and telling tales, and eating rags and pieces of leather from the village rubbish-heaps. But they are afraid of him too, because Tabaqui, more than anyone else in the jungle, is apt to go mad, and then he forgets that he was ever afraid of anyone, and runs through the forest biting everything in his way. Even the tiger runs and hides when little Tabaqui goes mad, for madness is the most disgraceful thing that can overtake a wild creature. We call it hydrophobia, but they call it dewanee--the madness-- and run.

"Enter, then, and look," said Father Wolf stiffly, "but there is no food here."

"For a wolf, no," said Tabaqui, "but for so mean a person as myself a dry bone is a good feast. Who are we, the Gidur-log [the jackal people], to pick and choose?" He scuttled to the back of the cave, where he found the bone of a buck with some meat on it, and sat cracking the end merrily.

[Read More at The Literature Page](http://www.literaturepage.com/read/thejunglebook-1.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
date: 2017-10-11T03:32:24-04:00
title: "Chapter 2: Hunting-Song of the Seeonee Pack"
description: "The Jungle Book"
author: "Rudyard Kipling"
featured_image: "/images/chapter-2-hunting-song-of-the-seeonee-pack.jpg"
draft: false
---
![Seeonee Pack](/images/chapter-2-hunting-song-of-the-seeonee-pack.jpg)

As the dawn was breaking the Sambhur belled
Once, twice and again!
And a doe leaped up, and a doe leaped up
From the pond in the wood where the wild deer sup.
This I, scouting alone, beheld,
Once, twice and again!

As the dawn was breaking the Sambhur belled
Once, twice and again!
And a wolf stole back, and a wolf stole back
To carry the word to the waiting pack,
And we sought and we found and we bayed on his track
Once, twice and again!

As the dawn was breaking the Wolf Pack yelled
Once, twice and again!
Feet in the jungle that leave no mark!

Eyes that can see in the dark--the dark!
Tongue--give tongue to it! Hark! O hark!
Once, twice and again!

[Read More at The Literature Page](http://www.literaturepage.com/read/thejunglebook-22.html)
31 changes: 31 additions & 0 deletions exampleSite/content/blog/chapter-3-kaas-hunting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
date: 2017-10-11T03:32:33-04:00
title: "Chapter 3: Kaa's Hunting"
description: "The Jungle Book"
author: "Rudyard Kipling"
featured_image: "/images/chapter-3-kaas-hunting-img.jpg"
draft: false
---
![Kaa's Hunting](/images/chapter-3-kaas-hunting-img.jpg)

His spots are the joy of the Leopard: his horns are the
Buffalo's pride.
Be clean, for the strength of the hunter is known by the
gloss of his hide.
If ye find that the Bullock can toss you, or the heavy-browed
Sambhur can gore;
Ye need not stop work to inform us: we knew it ten seasons
before.
Oppress not the cubs of the stranger, but hail them as Sister
and Brother,
For though they are little and fubsy, it may be the Bear is
their mother.
"There is none like to me!" says the Cub in the pride of his
earliest kill;
But the jungle is large and the Cub he is small. Let him
think and be still.
-- Maxims of Baloo

All that is told here happened some time before Mowgli was turned out of the Seeonee Wolf Pack, or revenged himself on Shere Khan the tiger. It was in the days when Baloo was teaching him the Law of the Jungle. The big, serious, old brown bear was delighted to have so quick a pupil, for the young wolves will only learn as much of the Law of the Jungle as applies to their own pack and tribe, and run away as soon as they can repeat the Hunting Verse --"Feet that make no noise; eyes that can see in the dark; ears that can hear the winds in their lairs, and sharp white teeth, all these things are the marks of our brothers except Tabaqui the Jackal and the Hyaena whom we hate." But Mowgli, as a man-cub, had to learn a great deal more than this. Sometimes Bagheera the Black Panther would come lounging through the jungle to see how his pet was getting on, and would purr with his head against a tree while Mowgli recited the day's lesson to Baloo. The boy could climb almost as well as he could swim, and swim almost as well as he could run. So Baloo, the Teacher of the Law, taught him the Wood and Water Laws: how to tell a rotten branch from a sound one; how to speak politely to the wild bees when he came upon a hive of them fifty feet above ground; what to say to Mang the Bat when he disturbed him in the branches at midday; and how to warn the water-snakes in the pools before he splashed down among them. None of the Jungle People like being disturbed, and all are very ready to fly at an intruder. Then, too, Mowgli was taught the Strangers' Hunting Call, which must be repeated aloud till it is answered, whenever one of the Jungle-People hunts outside his own grounds. It means, translated, "Give me leave to hunt here because I am hungry." And the answer is, "Hunt then for food, but not for pleasure."

[Read More at The Literature Page](http://www.literaturepage.com/read/thejunglebook-23.html)
45 changes: 45 additions & 0 deletions exampleSite/content/blog/chapter-4-road-song-of-the-bandar-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
date: 2017-10-11T03:32:52-04:00
title: "Chapter 4: Road-Song of the Bandar-Log"
description: "The Jungle Book"
author: "Rudyard Kipling"
featured_image: "/images/chapter-4-road-song-of-the-bandar-log-img.jpg"
draft: false
---
![Bandar-Log](/images/chapter-4-road-song-of-the-bandar-log-img.jpg)

Here we go in a flung festoon,
Half-way up to the jealous moon!
Don't you envy our pranceful bands?
Don't you wish you had extra hands?
Wouldn't you like if your tails were--so--
Curved in the shape of a Cupid's bow?
Now you're angry, but--never mind,
Brother, thy tail hangs down behind!

Here we sit in a branchy row,
Thinking of beautiful things we know;
Dreaming of deeds that we mean to do,
All complete, in a minute or two--
Something noble and wise and good,
Done by merely wishing we could.
We've forgotten, but--never mind,
Brother, thy tail hangs down behind!

All the talk we ever have heard
Uttered by bat or beast or bird--
Hide or fin or scale or feather--
Jabber it quickly and all together!
Excellent! Wonderful! Once again!

Now we are talking just like men!
Let's pretend we are ... never mind,
Brother, thy tail hangs down behind!
This is the way of the Monkey-kind.

Then join our leaping lines that scumfish through the pines,
That rocket by where, light and high, the wild grape swings.
By the rubbish in our wake, and the noble noise we make,
Be sure, be sure, we're going to do some splendid things!

[Read More at The Literature Page](http://www.literaturepage.com/read/thejunglebook-48.html)
22 changes: 22 additions & 0 deletions exampleSite/content/blog/chapter-5-tiger-tiger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
date: 2017-10-11T03:33:06-04:00
title: "Chapter 5: Tiger! Tiger!"
description: "The Jungle Book"
author: "Rudyard Kipling"
featured_image: ""
draft: false
---
What of the hunting, hunter bold?
Brother, the watch was long and cold.
What of the quarry ye went to kill?
Brother, he crops in the jungle still.
Where is the power that made your pride?
Brother, it ebbs from my flank and side.
Where is the haste that ye hurry by?
Brother, I go to my lair--to die.

Now we must go back to the first tale. When Mowgli left the wolf's cave after the fight with the Pack at the Council Rock, he went down to the plowed lands where the villagers lived, but he would not stop there because it was too near to the jungle, and he knew that he had made at least one bad enemy at the Council. So he hurried on, keeping to the rough road that ran down the valley, and followed it at a steady jog-trot for nearly twenty miles, till he came to a country that he did not know. The valley opened out into a great plain dotted over with rocks and cut up by ravines. At one end stood a little village, and at the other the thick jungle came down in a sweep to the grazing-grounds, and stopped there as though it had been cut off with a hoe. All over the plain, cattle and buffaloes were grazing, and when the little boys in charge of the herds saw Mowgli they shouted and ran away, and the yellow pariah dogs that hang about every Indian village barked. Mowgli walked on, for he was feeling hungry, and when he came to the village gate he saw the big thorn-bush that was drawn up before the gate at twilight, pushed to one side.

"Umph!" he said, for he had come across more than one such barricade in his night rambles after things to eat. "So men are afraid of the People of the Jungle here also." He sat down by the gate, and when a man came out he stood up, opened his mouth, and pointed down it to show that he wanted food. The man stared, and ran back up the one street of the village shouting for the priest, who was a big, fat man dressed in white, with a red and yellow mark on his forehead. The priest came to the gate, and with him at least a hundred people, who stared and talked and shouted and pointed at Mowgli.

[Read More at The Literature Page](http://www.literaturepage.com/read/thejunglebook-49.html)
53 changes: 53 additions & 0 deletions exampleSite/content/blog/chapter-6-mowglis-song.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
date: 2017-10-11T03:33:16-04:00
title: "Chapter 6: Mowgli's Song"
description: "The Jungle Book"
author: "Rudyard Kipling"
featured_image: ""
draft: false
---
THAT HE SANG AT THE COUNCIL ROCK WHEN HE
DANCED ON SHERE KHAN'S HIDE

The Song of Mowgli--I, Mowgli, am singing. Let the jungle
listen to the things I have done.

Shere Khan said he would kill--would kill! At the gates in the
twilight he would kill Mowgli, the Frog!

He ate and he drank. Drink deep, Shere Khan, for when wilt thou
drink again? Sleep and dream of the kill.

I am alone on the grazing-grounds. Gray Brother, come to me!
Come to me, Lone Wolf, for there is big game afoot!

Bring up the great bull buffaloes, the blue-skinned herd bulls
with the angry eyes. Drive them to and fro as I order.

Sleepest thou still, Shere Khan? Wake, oh, wake! Here come I,
and the bulls are behind.

Rama, the King of the Buffaloes, stamped with his foot. Waters of
the Waingunga, whither went Shere Khan?

He is not Ikki to dig holes, nor Mao, the Peacock, that he should
fly. He is not Mang the Bat, to hang in the branches. Little
bamboos that creak together, tell me where he ran?

Ow! He is there. Ahoo! He is there. Under the feet of Rama
lies the Lame One! Up, Shere Khan!

Up and kill! Here is meat; break the necks of the bulls!

Hsh! He is asleep. We will not wake him, for his strength is
very great. The kites have come down to see it. The black
ants have come up to know it. There is a great assembly in his
honor.

Alala! I have no cloth to wrap me. The kites will see that I am
naked. I am ashamed to meet all these people.

Lend me thy coat, Shere Khan. Lend me thy gay striped coat that I
may go to the Council Rock.

[Read More at The Literature Page](http://www.literaturepage.com/read/thejunglebook-67.html)
4 changes: 1 addition & 3 deletions exampleSite/data/projects/2014-07-05-project-1.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
modalID: 1
title: Project 1
date: 2014-07-05
img: 1.jpg
client: Start Bootstrap
clientLink: "#"
link: "#"
category: Web Development
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel enim aliquid dicta ullam in repellendus amet perspiciatis adipisci architecto obcaecati sit voluptas ipsam, deleniti neque placeat tenetur cum tempore velit.
4 changes: 1 addition & 3 deletions exampleSite/data/projects/2014-07-06-project-2.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
modalID: 2
title: Project 2
date: 2014-07-06
img: 2.jpg
client: Start Bootstrap
clientLink: "#"
link: "#"
category: Web Development
description: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel enim aliquid dicta ullam in repellendus amet perspiciatis adipisci architecto obcaecati sit voluptas ipsam, deleniti neque placeat tenetur cum tempore velit.
Loading