Remove the hard-coded footer and menu links

This commit is contained in:
Oliver Davies 2025-05-11 15:44:14 +01:00
parent 98472ea66b
commit 58869fa91e
6 changed files with 98 additions and 40 deletions

View file

@ -0,0 +1,25 @@
uuid: 99c8b757-57b6-4c44-81ac-46063b0bacac
langcode: en
status: true
dependencies:
config:
- system.menu.main
module:
- system
theme:
- opdavies
id: opdavies_mainnavigation
theme: opdavies
region: footer
weight: 0
provider: null
plugin: 'system_menu_block:main'
settings:
id: 'system_menu_block:main'
label: 'Main navigation'
label_display: '0'
provider: system
level: 1
depth: 0
expand_all_items: false
visibility: { }

View file

@ -7,3 +7,9 @@ definitions:
weight: 0
expanded: false
enabled: true
standard__front_page:
weight: -50
menu_name: main
parent: ''
enabled: true
expanded: false

View file

@ -2,9 +2,9 @@ _core:
default_config_hash: jtno5biznHZbrIgKwzq-ze-7XaQxLCGe6PeUOR7bRiQ
cache:
page:
max_age: 0
max_age: 3600
css:
preprocess: false
preprocess: true
gzip: true
fast_404:
enabled: true
@ -12,5 +12,5 @@ fast_404:
exclude_paths: '/\/(?:styles|imagecache)\//'
html: '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>'
js:
preprocess: false
preprocess: true
gzip: true

View file

@ -31,7 +31,11 @@
"value": "Contact"
}
],
"description": [],
"description": [
{
"value": "Email Oliver"
}
],
"menu_name": [
{
"value": "main"
@ -67,7 +71,7 @@
"parent": [],
"changed": [
{
"value": "2025-04-16T18:24:30+00:00"
"value": "2025-05-11T14:44:00+00:00"
}
],
"default_langcode": [

View file

@ -0,0 +1,49 @@
{#
/**
* @file
* Default theme implementation to display a menu.
*
* Available variables:
* - menu_name: The machine name of the menu.
* - items: A nested list of menu items. Each menu item contains:
* - attributes: HTML attributes for the menu item.
* - below: The menu item child items.
* - title: The menu link title.
* - url: The menu link URL, instance of \Drupal\Core\Url
* - localized_options: Menu link localized options.
* - is_expanded: TRUE if the link has visible children within the current
* menu tree.
* - is_collapsed: TRUE if the link has children within the current menu tree
* that are not currently visible.
* - in_active_trail: TRUE if the link is in the active trail.
*
* @ingroup themeable
*/
#}
{% import _self as menus %}
{{ menus.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if menu_level == 0 %}
<ul{{ attributes.addClass('flex flex-wrap justify-center -mb-3') }}>
{% else %}
<ul>
{% endif %}
{% for item in items %}
<li{{ item.attributes }}>
{{ link(item.title, item.url, {
class: 'mx-3 mb-3 text-base block underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900',
}) }}
{% if item.below %}
{{ menus.menu_links(item.below, attributes, menu_level + 1) }}
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}

View file

@ -97,12 +97,6 @@
{% endif %}
</main>
{% if page.footer %}
<footer role="contentinfo">
{{ page.footer }}
</footer>
{% endif %}
<div>
<h2 class="text-xl font-bold">About me</h2>
@ -120,34 +114,14 @@
</div>
</div>
<footer class="mt-16 mb-6">
<a id="footer" tabindex="-1"></a>
<nav class="flex flex-wrap justify-center -mb-3">
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/" title="Home">
Home
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/press" title="Press Info">
Press Info
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/pricing" title="Services">
Services
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/presentations" title="Presentations">
Presentations
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/podcast" title="The Beyond Blocks Podcast">
Podcast
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/daily" title="The Daily Drupaler Email List">
Daily list
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/sponsor" title="Sponsor me">
Sponsor me
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="mailto:oliver+website@oliverdavies.uk" title="Contact Oliver">
Contact
</a>
</nav>
</footer>
{% if page.footer %}
<div class="mt-16 mb-6">
<a id="footer" tabindex="-1"></a>
<footer>
{{ page.footer }}
</footer>
</div>
{% endif %}
</div>
</div>