.GetPage Test
SITE UPDATES
Latest
- Adding new Baguette Box JS image gallery and a code page.
- Added a Search Page based on a lovely simple solution. And a post about it
- The Docs is a new section for documentation about the site. So many features it’s easy to forget them or how they work. Link in the footer. (07.08.21)
- Added
css
option for frontmatter. This is an array that allows CSS rules to be added to the<head>
section stylesheet from the frontmatter. Also set the config file to allow HTML attributes to be added to HTML blocks like lists, tables, paragraphs etc. (03.08.21) - New
html
shortcode. Same as<div>
but without markdownify so can use for HTML tags and SVG. (01/06/21) - New
<div>
shortcode for generic CSS on the fly in Markdown. Takes class, id and style attributes. Used it to create this scrollable box. (29/05/21) - New Draft page with a list of draft articles (not viewable on live site, obviously.) (28/05/21)
- Added RSS icon to footer (26/05/21)
- Added next and previous page option in section pages (26/05/21)
- Added a dark theme (for OS’s set to dark mode), first using a CSS filter and then by changing the custom property colours. (25/05/21)
- Set up and image gallery using Photoswipe and Hugo’s page resources. This included new partial and shortcode:
photoswipe.html
andps_thumbs.html
. Photoswipe can be turned on or off in the frontmatter:photoswipe: off
. (24/05/21) - New Youtube and Soundcloud shortcodes. The youtube one, yt.html, uses
aspect-ratio
which is not well supported yet. - Changed About page into a leaf bundle
- Added meta description tags
- A new image shortcode
- Line Breaks in Headings
- Custom scroll bar added for FF and webkit browsers. (18/05/21)
- smooth scroll back to top button
- Site title subtitle
- Custom tags page.
- Music section added.
Less Late
- Chartism and Chart js libraries (10/05/21)
- Added mobile friendly slide in menu.
- Code block responsivity added.
- Added some reponsivity (though the code blocks are not responsive)
- Added Wavy background from BG Jar
- Embedded the clamp sizing tool.
- Enabled Git Info for dates and lastmod field.
- Sorted external links
extlinks
for frontmatter arrays - Favicon added.
- Added fonts Epilogue (main text) and Roboto Mono for code.
- Added new section for experimenting with: test-panel, which is above the footer
- Added type and section variables to the footer.
- Added a new section ‘code’ for chunks of code from the site
- Added Params / mainSections to the config file to allow the code section posts appear in the sidebar. The default behaviour is: “If the user has not set this config parameter in their site config, it will default to the section with the most pages.”
Earlier
- added hugo.Generator
- changed name of post to Syntax highlighting
- Changed the site url in config file to netlify.app from netlify.com
- changed summary to description in frontmatter and summary.html / summary did not work on Netlify.
- renamed some files so more logical in finding them
- added netlify.toml with hugo version (maybe also set this on Netlify too)
So here’s a quick experiment using .GetPage
. This can retrieve any page object in your given the right url. You can then get different parts of the page: .Content
, .Title
, .Permalink
etc.
Here I created a new folder /headless
and added an index.md
file with the setting headless: true
in the frontmatter. headless
is a predefined Hugo variable.
To retrieve the content section of the page I first created a shortcode, getpage-test.html
and then used with
like so:
1{{ with .Site.GetPage "/headless/index.md" }}
2 <div class="getpage-updates">
3 {{ .Content }}
4 </div>
5{{ end }}
The CSS class had some CSS applied through my frontmatter array css
.
NOTE: This won’t work with other pages in that /headless/
folder. That’s because other pages will be page resources and you need to use the
Layout on this page
The Site Updates box is floated to the right. This method ONLY works if the text on the left side (the content of this page) is long enough to push the bottom of the content section down far enough. A floated element can’t do this.
I tried experimenting with grid but for that to work you would need just 2 HTML elements and with the Site Updates box being inside section.content
every paragraph and heading becomes a grid item. So floating seems the only way to go.